SetQueryText
Syntax
sQryText
String
containing query text.
Description
Call
this method to set the query text or the content of the SQL pane of the ELS-QB control.
Remarks
SetQueryText
method
returns True if a query is open and the operation successful, otherwise it
returns False.
Example
This
sample code shows how
programmatically change SQL text of a sample
query named “Ordes” having as query text the following:“SELECT *
FROM Orders”
Dim
sConnName, sQryName
sConnName
= "Northwind"
sQryName
= "Orders"
If ELS_QBCtrl.OpenQuery(sConnName,
sQryName)
Then
Dim sSQL,
sOldSQL
sOldSQL =
ELS_QBCtrl.GetSQLText()
sSQL =
sOldSQL
sSQL = Replace(sSQL,
"Orders", "Customers")
If
ELS_QBCtrl.SetQueryText(sSQL)
Then
If ELS_QBCtrl.CheckSQLSyntax()
Then
ELS_QBCtrl.SetQueryName "Customers"
Else
ELS_QBCtrl.SetQueryText sOldSQL
End
If
End If
ELS_QBCtrl.SaveQuery
ELS_QBCtrl.CloseQuery
True
End
If