biuan SAP® BUSINESS ONE SDK
API Recordset / Do Query
Do Query Method

Description

Runs SQL queries.

Syntax

Visual Basic
Public Sub DoQuery( _
   ByVal QueryStr As String _
) 

Parameters

QueryStr

Specifies a query string, which contains the SQL query commands you want to run.

Return Type

-2000 ODBC Error.

Remarks

If the method is successful, the object will contain the returned query result set.

Limitation: Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

Example

The following example shows the DoQuery and MoveNext methods.
DoQuery and MoveNext methods sample (Visual Basic)
Name=Code_VB>
Dim Count As Long Dim FldName As String Dim FldVal As String Dim i As Long Dim RecSet As SAPbobsCOM.Recordset Set RecSet = vCmp.GetBusinessObject(BoRecordset) RecSet.DoQuery ("select * from OADM") Count = RecSet.Fields.Count While RecSet.EOF = False 'The inner loop runs over all the fields in one record (line) of the table For i = 0 To Count - 1 FldName = RecSet.Fields.Item(i).Name FldVal = RecSet.Fields.Item(i).Value 'Here you can manipulate the data as you want Next i 'Move to the next record RecSet.MoveNext Wend

See Also

Related information


Command Command Object
The Command object enables to run SQL stored procedures located in the company database. This object is called by the Recordset object.
   Parent: Recordset Recordset Object

Recordset XML Mode Enum RecordsetXMLModeEnum Enumeration
Types of XML to be returned for each record in the Recordset object.
   Parent: Recordset Recordset Object

Recordset Recordset Object
Recordset is a raw data access object that enables you to select data from the database, navigate through the result set, and manipulate user tables, which are not exposed by the DI API. The main method of this object is DoQuery that enables you...
   Parent: Data Browser DataBrowser Object


SAP® Business One is the trademark(s) or registered trademark(s) of SAP AG in Germany and in several other countries. Contact
This website is not affiliated with, maintained, authorized, endorsed or sponsored by SAP AG or any of its affiliates