Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - Programming » ODBC support » Ways to execute SQL statements

 

Direct statement execution

To execute a SQL statement in an ODBC application, allocate a handle for the statement using SQLAllocHandle and then call the SQLExecDirect function to execute the statement. Any parameters must be included as part of the statement (for example, a WHERE clause must specify its arguments). For a more flexible method of constructing statements, see Executing statements with bound parameters.

The SQLExecDirect function takes a statement handle, a SQL string, and a length or termination indicator, which in this case is a null-terminated string indicator. The statement may include parameters.

For more information about SQLExecDirect, see the Microsoft ODBC API Reference at [external link] http://msdn.microsoft.com/en-us/library/ms713611.aspx.

For a complete sample with error checking, see %SQLANYSAMP16%\SQLAnywhere\ODBCExecute\odbcexecute.cpp.

 Example