inserting a string variable
I'm trying to insert a string (5 byte hex) into the database.
I've tried:
String stringOne = "2d144bf28";
sprintf(buf, "INSERT INTO database.table VALUES (%s)", stringOne);
and
char* stringOne[ ] = {"2d144bf28"};
sprintf(buf, "INSERT INTO database.table VALUES (%s)", stringOne[0]);
Neither works.
First one hangs the sketch, second example gives "Error: 51 = Unknown column '2d144bf28' in 'field list'."
however;
int stringOne = 1234;
sprintf(buf, "INSERT INTO database.table VALUES (%i)", stringOne);
works fine.
Subject
Views
Written By
Posted
inserting a string variable
5176
September 21, 2014 08:49AM
2036
September 21, 2014 08:54AM
1935
September 21, 2014 12:18PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.