FetchNextRow()


" "

short FetchNextRow(long QueryID, VARIANT* Row)

Description

This function fetches the next row of data from the database.

Parameters

Name Description
QueryID The ID of the query, as returned from InitializeQuery() or InitializeStaticQuery().
Result

A pointer to a VARIANT in which the result will be stored. The result is an array (variant type VT_ARRAY | VT_VARIANT) containing one value for each column in the row. Call GetColumnCount() to determine the number of values in the array.

Each value is specified in its native data type or the closest variant data type. The supported return types are:

  • string (variant type VT_BSTR)
  • float (variant type VT_R4)
  • double (variant type VT_R8)
  • short (variant type VT_I2)
  • long (variant type VT_I4)
  • binary (variant type VT_UI1 | VT_ARRAY)

When the end of the result set has been reached (there are no more rows to fetch) or if the result set is empty, the result is empty (variant type VT_EMPTY) instead of an array.

Initialize the VARIANT before calling this function. Visual Basic does this automatically. Visual C++ programmers should call VariantInit().

Note:
Due to a bug in Microsoft Excel 7.0 and Microsoft Access 7.0 (and possibly other 32-bit Microsoft products that use Visual Basic for Applications), string data in variant variables received from QMF for Windows may not be translated from Unicode (used by OLE) to ANSI (used by VBA). When this occurs, only the first character of the string is displayed. To remedy this problem, set the variable equal to an empty string before you call the QMF for Windows function that uses the variable.
.

Return Value

The return value will be zero if successful or non-zero if unsuccessful. If the return value is non-zero, you can call GetLastErrorString(), GetLastErrorType(), GetLastSQLCode(), GetLastSQLError(), or GetLastSQLState() to get additional error information.

Related Tasks

FetchNextRowEx()
FetchNextRows()
FetchNextRowsEx()