4D v14.1ODBC_SQLFetch |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v14.1
ODBC_SQLFetch
|
ODBC_SQLFetch ( stmtID ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
stmtID | Longint |
![]() |
Statement ID | |||||
Function result | Longint |
![]() |
Returns the result of the MS ODBC API function SQLFetch | |||||
The ODBC_SQLFetch command fetches the next rowset of data from the result set and returns data for all bound columns.
stmtID is a valid statement ID returned by ODBC_SQLAllocStmt.
For more information, please see the SQLFetch function in the MS ODBC API Reference at http://msdn.microsoft.com/en-us/library/ms712424(VS.85).aspx.
SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_NO_DATA, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.
The following method selects all the records from the Employee table, ccreates a bind with our data source's Employee table and its four fields specified by the ODBC_SQLPrepare and ODBC_SQLBindCol commands, and then creates one record for each row of data in the 4D table [Employees]:
$result:=ODBC_SQLPrepare($statementID;"SELECT * FROM Employee")
$result:=ODBC_SQLExecute($statementID)
$result:=ODBC_SQLBindCol($statementID;1;->[Employees]Emp_ID)
$result:=ODBC_SQLBindCol($statementID;2;->[Employees]Emp_Fullname)
$result:=ODBC_SQLBindCol($statementID;3;->[Employees]Emp_HireDate)
$result:=ODBC_SQLBindCol($statementID;4;->[Employees]Emp_CurrentEmployee)
While($result#SQL_NO_DATA)
CREATE RECORD([Employees])
$result:=ODBC_SQLFetch($statementID)
If($result#SQL_NO_DATA)
SAVE RECORD([Employees])
End if
End while
UNLOAD RECORD([Employees])
$result:=ODBC_SQLFreeStmt($statementID;SQL_UNBIND)
Product: 4D
Theme: ODBC_Results
Number:
16960
Created: 4D ODBC Pro 2004
ODBC_SQLBindCol
ODBC_SQLFetchScroll
ODBC_SQLFreeStmt
4D ODBC Pro ( 4D ODBC Pro v11.4)
4D ODBC Pro ( 4D ODBC Pro v12)
4D ODBC Pro ( 4D v13)
4D ODBC Pro ( 4D v14 R3)
4D ODBC Pro ( 4D v14.1)
4D ODBC Pro ( 4D v14 R2)
4D ODBC Pro ( 4D v14 R4)