Page 1 of 1

sqlquery: Insert into issue

Posted: July 10th, 2018, 12:19 pm
by htuser
Dear All,
I'm trying to insert some items into table previously created.
1.- I create table : string sqlReq = maketext("CREATE TABLE IF NOT EXISTS identifiant_questionnaire (idTable INTEGER AUTOINCREMENT NOT NULL, codetablet INTEGER,codeutilisateur INTEGER, numeroquestionnaire INTEGER)");
sqlquery(SQLITEDB,sqlReq);

2.- I insert data:
string sqlReq2 = maketext ("INSERT INTO identifiant_questionnaire VALUES (%v,%d, %v, %v)",CODE_ENQUETEUR,noTablet(),CODE_OPERATEUR,IQ_1_NUMERO_DU_QUESTIONNAIRF);
warning ("requete la se %v",sqlReq2);
sqlquery(SQLITEDB,sqlReq2);
But, unfortunately, noone data has been inserted. What i'm doing wrong with insert into?

Thanks in advance for your support!

Re: sqlquery: Insert into issue

Posted: July 10th, 2018, 5:22 pm
by Gregory Martin
Your INSERT statement is not valid. See more here:

http://www.sqlitetutorial.net/sqlite-insert/

Your best option is to get a program like DB Browser for SQLite, write and test your queries in it, and then copy the query back into CSPro.

Re: sqlquery: Insert into issue

Posted: July 11th, 2018, 1:25 am
by htuser
Thanks Greg for your unconditional support and sorry for this very basic request... It was an unbelievable mistake from my own part...
Best Regards,