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 http://msdn.microsoft.com/en-us/library/ms713611.aspx.
For a complete sample with error checking, see %SQLANYSAMP16%\SQLAnywhere\ODBCExecute\odbcexecute.cpp.
![]() |
Discuter à propos de cette page dans DocCommentXchange.
|
Copyright © 2013, SAP AG ou société affiliée SAP - SAP Sybase SQL Anywhere 16.0 |