Hello everyone.
Im trying to create a cmd application in VS2010 C++,in which i will read some integer values and insert them into a table in MS SQL server. For the connection of the application with the server i use ODBC.

If i use something like the following, i get results (insert is working):

if(SQL_SUCCESS!=SQLExecDirect(sqlstatementhandle,(SQLCHAR*)"INSERT INTO MyTable(value1) VALUES (111)", SQL_NTS)){
show_error(SQL_HANDLE_STMT, sqlstatementhandle);

}

after the execution of the code above if i check the database i can see that insert worked just fine. Can someone tell me how i can use variables in the insert query, instead of numbers(like 111 above)?

Also since i couldnt find the proper syntax of insert with integer variables, i tried to create a stringstream(concatenating the insert command with the integer variables), which i later convert to string and use it in my sql command. Unfortunately it doesnt work either!

can someone help please?
thank you