Objective Grid: Can I change the query for a grid at runtime?

Article ID: 494
Last updated: 25 Apr, 2018
Article ID: 494
Last updated: 25 Apr, 2018
Revision: 3
Views: 1449
Posted: 11 Jan, 2001
by Meltreger B.
Updated: 25 Apr, 2018
by Meltreger B.

Problem

 


Can I change the query for a grid at runtime?

 

 


Cause

 


 

 


Action

 


You have to close the recordset and reopen it.

Example:
 

void CGxqueryView::OnRecordNewquery()
{
// Display dialog, so that user can
// enter the query string
CMyQueryDialog dlg;

// disable ReadOnly, Use CursorLibray, Exclusive checkbox
dlg.m_bOpenDatabase = FALSE;

// reuse last query string
dlg.m_sSQLString = m_pSet->GetSqlQuery();

if (dlg.DoModal() == IDOK)
{

// Cancel pending changes and close recordset
UndoRecord();
m_pSet->Close();

// Transfer query string and reopen recordset
m_pSet->SetSqlQuery(dlg.m_sSQLString);
OpenRecordset();

}
}


 

This article was:   Helpful | Not helpful
Report an issue
Article ID: 494
Last updated: 25 Apr, 2018
Revision: 3
Views: 1449
Posted: 11 Jan, 2001 by Meltreger B.
Updated: 25 Apr, 2018 by Meltreger B.

Others in this category