I'm sorry, but what do you mean??
I think I am asking a Qt related question, because I want to use SQLite in Qt, but it doesn't work well.
I'm sorry, but what do you mean??
I think I am asking a Qt related question, because I want to use SQLite in Qt, but it doesn't work well.
you have to prepare correct SQL-query for a table creation and wysota posted a link how to do this in right way.
EDITED: take a look at connection.h which is located in QTDIR/examples/sql.
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
I use this to create a table whick is a variable "tableName", why the following codes doesn't woek:
Qt Code:
QSqlQuery build; "id INTEGER PRIMARY KEY AUTOINCREMENT," "name VARCHAR(90)" "author VARCHAR(50)" "copy INTEGER" "press VARCHAR(120))").arg( name) )To copy to clipboard, switch view to plain text mode
and before these codes, I have open the database.
Thanks in advance.
what kind of error do you get? maybe this table already exists?
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
I don't know, I jusr use the following codes:
Qt Code:
QSqlQuery build; "id INTEGER PRIMARY KEY AUTOINCREMENT," "name VARCHAR(90)" "author VARCHAR(50)" "copy INTEGER" "press VARCHAR(120))").arg( name) ) if( !ok )To copy to clipboard, switch view to plain text mode
But I am sure the table doesn't exit.
puzzled.
modify you code like this
and show us a result.Qt Code:
QSqlQuery build; "id INTEGER PRIMARY KEY AUTOINCREMENT," "name VARCHAR(90)" "author VARCHAR(50)" "copy INTEGER" "press VARCHAR(120))").arg( name) ) if( !ok )To copy to clipboard, switch view to plain text mode
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
Oh, I have solved it !!
I miss the comma among the fields!!
Thank you for your replying.
ok, but anyway, use code which I posted above for determination errors, it will help you in a future.
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
sophister (8th April 2009)
Uh, yeah, you are right maybe.
I learn a lot from this forum.
Bookmarks