Help Center

CODBCStmt.Constructorsconstructor

Allocates a statement handle.

DatabasesconstructorCODBCStmt.incdoc-orphan
No implementation located. This member is documented, but the source scan found no matching declaration. It is likely declared in a header this scan does not resolve, or provided by a macro.

Syntax

CONSTRUCTOR COdbcStmt (BYVAL pDbc AS COdbc PTR)
CONSTRUCTOR COdbcStmt (BYREF pCDbc AS COdbc)

Parameters

NameDescription
pDbcPointer to a connection object.
pCDbcReference 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