string variable in C++ to be used qith odbc sql insert
Hello everyone,
im trying to use an sql insert into a C++ application but unfortunately i cant input the values of the string variables to the tables!
below is an example of my insert statement, the same statement works fine with integers, etc but not with string variables!
Code:
sprintf((char*)SQLStmt,"INSERT INTO teststr(thestr) VALUES ('%s');",str);
if(SQL_SUCCESS!=SQLExecDirect(sqlstatementhandle,SQLStmt, SQL_NTS)){
show_error(SQL_HANDLE_STMT, sqlstatementhandle);
}
can you help please?
thanx