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(?)", -1, 
&pVM, &szTail);
   nRes = sqlite3_bind_text(mpVM, 1, "Hello", -1, SQLITE_TRANSIENT);
   nRest = sqlite3_step(mpVM);

HTH
Martin

[email protected] wrote:
> 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 probes VALUES('%s', :temp)";
>     rc = sqlite3_exec(db, sql, NULL, NULL, &zErr);
>
> Thank you
>
> Michael
>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>   
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to