Rob Richardson wrote:
> Put single quotes around Testitem:
> 
>       sprintf( sqlquery, "INSERT INTO tblTest ( CINDEX, CDATE, CDESCR, 
> CAMOUNT ) VALUES ( 5, 2012-08-29, 'Testitem', 300 )");

And around cdate too. There are no dedicated date type in sqlite, 2012-08-29 is
treated as expression ((2012 - 08) - 29). Result will be 1975, not what you
might have expected.

sprintf( sqlquery, "INSERT INTO tblTest ( CINDEX, CDATE, CDESCR, CAMOUNT )
VALUES ( 5, '2012-08-29', 'Testitem', 300 )");

And you likely should use sqlite3_prepare_v2, placeholders, sqlite3_bind_int and
sqlite3_bind_text instead of sprintf.

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to