[sqlite] Store the value from a variable into a field in database table

2016-01-22 Thread Hick Gunter
You can either printf() the statement to insert the value into the text, or use 
SQL variables to prepare the generic statement and sqlite3_bind_xxx() the 
desired value.

-Urspr?ngliche Nachricht-
Von: sqlite-users-bounces at mailinglists.sqlite.org 
[mailto:sqlite-users-bounces at mailinglists.sqlite.org] Im Auftrag von 
Krishnajith S S
Gesendet: Donnerstag, 21. J?nner 2016 19:04
An: sqlite-users at mailinglists.sqlite.org
Betreff: [sqlite] Store the value from a variable into a field in database table

How can I store the data from a variable into a field in the database table?

For eg:

int z = 50;

How to insert the data in z into a field in table?

sql = "INSERT INTO TABLE (ID, DATA)" \
 "VALUES (1, z)" ;";

The above doesn't work. Please help.
___
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___
 Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: hick at scigames.at

This communication (including any attachments) is intended for the use of the 
intended recipient(s) only and may contain information that is confidential, 
privileged or legally protected. Any unauthorized use or dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please immediately notify the sender by return e-mail message and 
delete all copies of the original communication. Thank you for your cooperation.




[sqlite] Store the value from a variable into a field in database table

2016-01-22 Thread Simon Slavin

On 21 Jan 2016, at 6:04pm, Krishnajith S S  wrote:

> How can I store the data from a variable into a field in the database
> table?

What programming language are you writing in ?

Simon.


[sqlite] Store the value from a variable into a field in database table

2016-01-22 Thread Warren Young
On Jan 22, 2016, at 6:15 AM, Hick Gunter  wrote:
> 
> You can either printf() the statement to insert the value into the text

Please don?t say such things to newbies.  It?s fine for an integer, but he?s 
going to move on to strings next and then he?ll have a SQL injection 
vulnerability.


[sqlite] Store the value from a variable into a field in database table

2016-01-21 Thread Krishnajith S S
How can I store the data from a variable into a field in the database
table?

For eg:

int z = 50;

How to insert the data in z into a field in table?

sql = "INSERT INTO TABLE (ID, DATA)" \
 "VALUES (1, z)" ;";

The above doesn't work. Please help.