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

Article ID: 362
Last updated: 27 Apr, 2018
Article ID: 362
Last updated: 27 Apr, 2018
Revision: 4
Views: 1679
Posted: 10 Jan, 2001
by Meltreger B.
Updated: 27 Apr, 2018
by Meltreger B.

Problem


How can I change the query for a DAO grid at runtime?


Cause



Action


Here is some sample code:
 

void CDaoqueryView::OnRecordNewquery()
{
// Display dialog, so that user can
// enter the query string
CMyQueryDialog dlg;
CDaoRecordset* pSet = OnGetRecordset();

// reuse last query string
dlg.m_sSQLString = pSet->GetSQL();

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

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

// Transfer query string and reopen recordset
pSet->Open(AFX_DAO_USE_DEFAULT_TYPE, dlg.m_sSQLString);
OpenRecordset();

}
return;
}


 

This article was:   Helpful | Not helpful
Report an issue
Article ID: 362
Last updated: 27 Apr, 2018
Revision: 4
Views: 1679
Posted: 10 Jan, 2001 by Meltreger B.
Updated: 27 Apr, 2018 by Meltreger B.

Others in this category