GetSQLText
Syntax:
BSTR GetSQLText();
Return
Value: BSTR string
object containing the text of the currently active SQL statement from the SQL pane.
Note:
The returned string may be empty.
Remarks:
Call
this method to obtain the SQL query currently displayed in the SQL pane of ELS-QB control.
Example:
This
sample code shows how
programmatically change SQL text of a sample query created in NewQuery(). Example
CString
strConnName = _T("Northwind");
CString strQryName =
_T("Orders");
if(m_QBCtrl.OpenQuery(strConnName, strQryName))
{
CString strSQL, strOldSQL;
strSQL = strOldSQL= m_QBCtrl.GetSQLText();
strSQL.Replace(_T("Orders"), _T("Customers"));
if(m_QBCtrl.SetQueryText(strSQL))
{
if(m_QBCtrl.CheckSQLSyntax())
m_QBCtrl.SetQueryName(_T("Customers"));
else
m_QBCtrl.SetQueryText(strOldSQL);
}
m_QBCtrl.SaveQuery();
m_QBCtrl.CloseQuery(TRUE);
}