| DoQuery Method | |
| See Also Example |
- QueryStr
Specifies a query string, which contains the SQL query commands you want to run.
Runs SQL queries.
| Visual Basic |
|---|
Public Sub DoQuery( _
ByVal QueryStr As String _
) |
- QueryStr
Specifies a query string, which contains the SQL query commands you want to run.
-2000 ODBC Error.
If the method is successful, the object will contain the returned query result set.
Note: As of SAP Business One 10.0, the DoQuery function can access the current logon company DB only. If you access Common DB, the DoQuery function will throw exception.
Limitation: Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
Other limitations includes the following query usage:
- Nested Query
- Query with Union and Union ALL
- Using Like
- Using Ali
- Flow control statments (If / While / Break / Continue)
- Calling procedures, fuctions, triggers and etc.
- Distinct (i.e: "SELECT DISTINCT CardType FROM OCRD")
- Multiple queries (i.e: Queries seperated with ; (semicolons) may not work, if there is no space before it)
The following example shows the DoQuery and MoveNext methods.
| DoQuery and MoveNext methods sample (Visual Basic) | Copy Code | |
|---|---|---|
| ||