NewQuery
Syntax:
BOOL NewQuery();
Return
Value: TRUE if the Connection pane of ELS-QB is enabled,
otherwise returns FALSE.
Remarks:
This
method creates and selects upon creation a new query, having default node label,
under the currently selected connection container in the Databases folder of ELS-QB component’s Connection pane.
Note: the default label of a newly
created query may be renamed at any time after its
creation.
Example:
This
sample code shows how to create programmatically a new query in ELS-QB
component.
void
CELS_QBDemoView::OnFileNewquery()
{
CString
strConnName = _T(“Northwind”);
if(!m_QBCtrl.OpenDBConnection(strConnName))
return;
if(m_QBCtrl.NewQuery())
{
CString strQryName =
_T(“Orders”);
m_QBCtrl.SetQueryName(strQryName);
m_QBCtrl.SetQueryText(_T(“SELECT * FROM Orders”));
if(m_QBCtrl.CheckSQLSyntax())
m_QBCtrl.SaveQuery();
else
m_QBCtrl.RemoveQuery(strConnName,strQryName);
}
}