version 2004
ODBC_SQLFetch (stmtID) Longint
Parameter | Type | Description | |
stmtID | Longint | Statement ID | |
Function result | Longint | Returns the result of the MS ODBC API function | |
SQLFetch |
Description
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 at http://msdn.microsoft.com/library/en-us/odbc/htm/odbcsqlfetch.asp.
Function Results
SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_NO_DATA, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.
Example
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 4th Dimension 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 )
See Also
ODBC_SQLBindCol, ODBC_SQLFetchScroll, ODBC_SQLFreeStmt.