CODBCStmt.Constructorsconstructor
Allocates a statement handle.
Syntax
CONSTRUCTOR COdbcStmt (BYVAL pDbc AS COdbc PTR)
CONSTRUCTOR COdbcStmt (BYREF pCDbc AS COdbc)
Parameters
| Name | Description | |
|---|---|---|
pDbc | Pointer to a connection object. | |
pCDbc | Reference to an instance of the CODBC class. |
Description
Allocates a statement handle. A statement handle provides access to statement information, such as error messages, the cursor name, and status information for SQL statement processing.
Result code (GetLastResult)
SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_INVALID_HANDLE, or SQL_ERROR.
Example
#include once "AfxNova/COdbc.inc" USING AfxNova
' // Create a connection object and connect with the database DIM wszConStr AS WSTRING * 260 = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=biblio.mdb" DIM pDbc AS CODBC = wszConStr
' // Allocate an statement object DIM pStmt AS COdbcStmt = pDbc
' // Generate a result set pStmt.ExecDirect ("SELECT * FROM Authors ORDER BY Author")
' // Parse the result set DIM dwsOutput AS DWSTRING DO ' // Fetch the record IF pStmt.Fetch = FALSE THEN EXIT DO ' // Get the values of the columns and display them dwsOutput = "" dwsOutput += pStmt.GetData(1) & " " dwsOutput += pStmt.GetData(2) & " " dwsOutput += pStmt.GetData(3) PRINT dwsOutput LOOP
Reference
- Include file
CODBCStmt.inc - Documented in Databases/ODBC Classes/CODBCStmt Class.md
- Topic: CODBCStmt Class