[Qt-interest] Why the sql sentence can't be exec in QSqlQuery?

Stephen Jackson spjackson42 at gmail.com
Sun Jun 14 18:01:57 CEST 2009


On Sun, Jun 14, 2009 at 4:51 PM, Kermit Mei wrote:
> Hello community!
>
> In Linux sqlite3, I can run this command and get the correct result:
>
>
> sqlite> SELECT text,pos_x,pos_y,size_x,size_y FROM WidgetItem
>   ...> INNER JOIN CWPage ON WidgetItem.CWPageId=CWPage.id;
> btn1|0|0|32|32
> btn2|0|32|32|32
> btn3|0|64|32|32
> btn4|32|32|32|32
> btn5|32|64|32|32
>
> But in my Qt4 code:
>
> query.exec("SELECT text,pos_x,pos_y,size_x,size_y"
>                        "FROM WidgetItem"
>                        "INNER JOIN CWPage"
>                        "ON WidgetItem.CWPageId=CWPage.id;")
>
> This is always return false.
>

Assuming that you have accurately pasted your code into your email,
then you are missing spaces before FROM, INNER and ON. Also, you do
not need the terminating semi-colon (I'm not sure whether this is an
error).

Regards,

Stephen Jackson




More information about the Qt-interest-old mailing list