Click to See Complete Forum and Search --> : Q:Showing list of items of large database.


Jack Shainsky
May 23rd, 1999, 07:19 AM
Hello!

I'm writing a database application and I want to show list of items from the DAO recordset(in ListBox and in List Control).

I do it with code like this (example for list box):

void FillListBox(CMyRecordset *prsData, CListBox *plbBox)
{
ASSERT(psData->IsOpen())
prsData->MoveFirst();
while(!prsData->IsEOF())
{
plbBox->AddString(prsData->m_MyString);
prsData->MoveNext();
}
}




It works fine with small databases, but when number of records in database is about 100000 or more, it works very slow(about 5 - 10 minutes).
All that I need is to display the list of items and allow user to choose some of them. How can I do this without loosing performance?

Thank you in advance,

Jack Shainsky
Jerusalem, Israel.
jack.shainsky@usa.net

Howard Birkett
May 23rd, 1999, 02:10 PM
Try using a ListCtrl in virtual mode - there is an article (or sample) in MSDN

Howard.