我正在使用QT并使用sqlite。当我这样写:
QSqlQuery q = db_.exec("SLECT *"
"From history;");
它按预期工作,但有了这个,我什么都没得到:
QSqlQuery q = db_.exec("SLECT *"
"From history"
"ORDER BY id ASC;");
这是表创建:
db_.exec("CREATE TABLE IF NOT EXISTS history ("
"id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
"url TEXT,"
"day REAL,"
"month REAL,"
"year REAL,"
"hour REAL,"
"minute REAL,"
"second REAL"
");");
由于
答案 0 :(得分:2)
除了SELECT
错过E
之外,您还可能需要*
和From
之间以及history
和{{1}之间的空白字符 - 尝试:
ORDER
答案 1 :(得分:1)
我认为问题出在SLECT
,应该是SELECT
。其他语法似乎没问题。