4D v16

ODBC_SQLFetch

Página Inicial

 
4D v16
ODBC_SQLFetch

ODBC_SQLFetch 


 

ODBC_SQLFetch ( stmtID ) -> Resultado 
Parâmetro Tipo   Descrição
stmtID  Inteiro longo in Statement ID
Resultado  Inteiro longo in 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.

Exemplo  

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)



Ver também 

ODBC_SQLBindCol
ODBC_SQLFetchScroll
ODBC_SQLFreeStmt

 
PROPRIEDADES 

Produto: 4D
Tema: ODBC_Results
Número 16960

 
HISTÓRIA 

Criado por: 4D ODBC Pro 2004

 
ARTICLE USAGE

4D ODBC Pro ( 4D v16)