一种方法是:
char SQLQuery[] = "INSERT INTO people(name, age) VALUES ( 'patrick', '23')";
if (SQL_SUCCESS != SQLExecDirect(SQLStatementHandle, (SQLCHAR*)SQLQuery, SQL_NTS)) {
// Executes a preparable statement
showSQLError(SQL_HANDLE_STMT, SQLStatementHandle);
break;
}
但是如果我想向sqlquery添加整数和字符串怎么办
string myString = "patrick";
int myInt = 23;
char SQLQuery[] = "INSERT INTO people(name, age) VALUES ( 'myString', 'myAge')";
if (SQL_SUCCESS != SQLExecDirect(SQLStatementHandle, (SQLCHAR*)SQLQuery, SQL_NTS)) {
// Executes a preparable statement
showSQLError(SQL_HANDLE_STMT, SQLStatementHandle);
break;
}