August 25th, 1999, 06:50 PM
I have a basic "add-change-delete" CRecordView based application which uses ODBC and Access.
Everything works great, and I am using a single CRecordSet. I would like to have simultaneous access to another CRecordset.
For simplicity (my actual case is more complicated), lets say my record view has 6 fields: Name, Address, City, State, Zip and Age. The Age is in its own recordset. For every name/address that I scroll through in the database, I would like the age of the person also displayed for each record.
I created a CDatabase object.
I then constructed a recordset, passing a CDatabase pointer to the CRecordset constructor.
// MyDoc.h
CMyPrimarySet* m_pSet;
CDatabase m_database;
//...
CMyDocument::OnNewDocument
{
if (!CDocument::OnNewDocument())
return FALSE;
if(m_pSet == NULL) {
m_pSet = new CMyPrimarySet(&m_database);
CString strConnect = m_pSet->GetDefaultConnect();
m_database.Open(NULL, FALSE, FALSE, strConnect, FALSE);
}
return TRUE;
}
I have this in my view's OnInitialUpdate:
CMyView::OnInitialUpdate()
{
//...
m_pSet = GetDocument()->m_editClearingLabelsSet;
//...
AgeRecordSet m_pAgeset(&pDoc->m_database);
}
Ok, I think I have the multiple recordsets set up correctly. Now, I am totally confused about the proper way to sequence through my records and have the age displayed along with each record.
I have tried several different ways, all to no avail.
Any clues?
Thanks in advance.
Everything works great, and I am using a single CRecordSet. I would like to have simultaneous access to another CRecordset.
For simplicity (my actual case is more complicated), lets say my record view has 6 fields: Name, Address, City, State, Zip and Age. The Age is in its own recordset. For every name/address that I scroll through in the database, I would like the age of the person also displayed for each record.
I created a CDatabase object.
I then constructed a recordset, passing a CDatabase pointer to the CRecordset constructor.
// MyDoc.h
CMyPrimarySet* m_pSet;
CDatabase m_database;
//...
CMyDocument::OnNewDocument
{
if (!CDocument::OnNewDocument())
return FALSE;
if(m_pSet == NULL) {
m_pSet = new CMyPrimarySet(&m_database);
CString strConnect = m_pSet->GetDefaultConnect();
m_database.Open(NULL, FALSE, FALSE, strConnect, FALSE);
}
return TRUE;
}
I have this in my view's OnInitialUpdate:
CMyView::OnInitialUpdate()
{
//...
m_pSet = GetDocument()->m_editClearingLabelsSet;
//...
AgeRecordSet m_pAgeset(&pDoc->m_database);
}
Ok, I think I have the multiple recordsets set up correctly. Now, I am totally confused about the proper way to sequence through my records and have the age displayed along with each record.
I have tried several different ways, all to no avail.
Any clues?
Thanks in advance.