Bookshelf Home | Contents | Index | Search | PDF |
Siebel VB Language Reference > Siebel VB Language Reference >
SQLExecQuery Function
This custom VB function executes a SQL statement on a connection established by SQLOpen.
NOTE: Siebel VB SQLxxxx functions are supported for non-Unicode databases only.
Syntax
SQLExecQuery(connection, query)
Argument Description connection A long integer returned by SQLOpen query A string containing a valid SQL statementReturns
The number of columns in the result set for SQL SELECT statements as a variant.
Usage
If the function is unable to execute the query on the specified data source, or if the connection is invalid, a negative error code is returned.
If SQLExecQuery is called and there are any pending results on that connection, the pending results are replaced by the new results.
CAUTION: This function, as well as the other SQL functions available in Siebel VB, should not be used to query the underlying database. Use the Siebel Object Interfaces to query Siebel data. Use the SQL functions only to query non-Siebel data.
Example
This example performs a query on the data source.
Sub Button_Click
' Declarations
Dim connection As Long
Dim destination(1 To 50, 1 To 125) As Variant
Dim retcode As long
' open the connection
connection = SQLOpen("DSN = SblTest",outputStr,prompt: = 3)' Execute the query
query = "select * from customer"
retcode = SQLExecQuery(connection,query)
' retrieve the first 50 rows with the first 6 columns of
' each row into the array destination, omit row numbers and
' put column names in the first row of the arrayretcode = SQLRetrieve(connection: = connection, _
destination: = destination, columnNames: = 1,rowNumbers: _
= 0,maxRows: = 50, maxColumns: = 6,fetchFirst: = 0)' Get the next 50 rows of from the result set
retcode = SQLRetrieve(connection: = connection, _
destination: = destination, columnNames: = 1,rowNumbers: _
= 0,maxRows: = 50, maxColumns: = 6)
' Close the connection
retcode = SQLClose(connection)
End SubSee Also
SQLClose Function
SQLError Function
SQLGetSchema Function
SQLOpen Function
SQLRequest Function
SQLRetrieve Function
SQLRetrieveToFile Function
Bookshelf Home | Contents | Index | Search | PDF |
Siebel VB Language Reference Published: 18 June 2003 |