sqlquery: Insert into issue

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
htuser
Posts: 631
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

sqlquery: Insert into issue

Post 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!
G.VOLNY, a CSProuser from Haiti, since 2004
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: sqlquery: Insert into issue

Post 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.
htuser
Posts: 631
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Re: sqlquery: Insert into issue

Post 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,
G.VOLNY, a CSProuser from Haiti, since 2004
Post Reply