Re: [sqlite] insert in C

2009-03-11 Thread mrobi002
Hi Rajesh Nair, It works perfectly, Thank you, Michael > If you want to use sqlite3_exec function then try this > > char *zSQL = sqlite3_mprintf("INSERT INTO probes VALUES(%Q)", temp); > sqlite3_exec(db, zSQL, 0, 0, 0); > sqlite3_free(zSQL); > > This will format "temp" to hold any special chars

Re: [sqlite] insert in C

2009-03-11 Thread Rajesh Nair
If you want to use sqlite3_exec function then try this char *zSQL = sqlite3_mprintf("INSERT INTO probes VALUES(%Q)", temp); sqlite3_exec(db, zSQL, 0, 0, 0); sqlite3_free(zSQL); This will format "temp" to hold any special chars which may generate some errors. eg:- temp = " Rajesh's Test " will be

Re: [sqlite] insert in C

2009-03-11 Thread Martin Engelschalk
Hi, use sqlite3_prepare and sqlite3_bind. See http://www.sqlite.org/capi3ref.html#sqlite3_prepare and sqlite3_bind_text under http://www.sqlite.org/capi3ref.html#sqlite3_bind_blob const char* szTail=0; sqlite3_stmt* pVM; int nRet = sqlite3_prepare(mpDB, "insert into table1 values(?)",

[sqlite] insert in C

2009-03-11 Thread mrobi002
Good Morning, I would like to write in C the equivalent code for: insert into table1 values('Hello'); using a variable char temp[20]= "Hello"; instead of the literal Hello I have used multiple variations of the following, but no luck char temp[20]= "Hello"; sql = "INSERT INTO pro