Click to See Complete Forum and Search --> : ODBC recordset loop executes only 200 times???


April 25th, 1999, 03:50 PM
reply at bgajjar@yahoo.com

can anyone tell me why my recordset search loop executes exactly 200 times only????

i have used the microsoft cal.control in my database application ( contact manager). the goal is to find a record in the database which matches the date clicked by the user on the calendar control. i can search the record if it exists in first 200 records only!!! beyond that my loop terminates exactly after 200 counts???

void CCont1View::OnClickCalendar1()
{
AfxMessageBox("start");
CRecordset* pRecordset= OnGetRecordset();

m_pSet->MoveFirst();

int date = m_pcalender.GetDay();
int month = m_pcalender.GetMonth();
int year = m_pcalender.GetYear();

CString sd,sm,sy;
sd.Format("%d",date);
sm.Format("%d",month);
sy.Format("%d",year);
int count =0;

CString dates = sd + sm + sy;
AfxMessageBox(dates);
while(!(m_pSet->IsEOF()))
{
CString temp;
temp.Format("%d",count);
AfxMessageBox(temp);

//get the date in object t
CTime t = m_pSet->m_DATE;

//extract date
CString s1=t.Format("%d");
if (strcmp(s1,sd)==0)
{
AfxMessageBox("dates matched");
//for month
int s22=t.GetMonth();
if (s22=month)
{
AfxMessageBox("month matched");
//for year
CString s3=t.Format("%Y");
if(strcmp(s3,sy)==0)
{
AfxMessageBox("found one ");
m_pSet->m_DATE;
SetDlgItemText(IDC_TEL,m_pSet->m_TEL);
SetDlgItemText(IDC_CNAME,m_pSet->m_FAX_COMP);
//SetDlgItemText(IDC_DATE,s1+s2+s3);
goto end; }
}
}
else
{
m_pSet->MoveNext();
if ( count == 190 )
{ AfxMessageBox("resetting");
CRecordset* pRecordset= OnGetRecordset();}
count=count+1;
}
CString counter;
counter.Format("%d",count);
SetDlgItemText(IDC_DATE,counter);
}
AfxMessageBox("not found");
end:
CRecordView::OnInitialUpdate();

}

Hussam
April 25th, 1999, 04:15 PM
Well I do not know exactly but I had a similar problem and the number was 169.

The reason was that I forgott to close the tables after every search (open).

But when I added the sentence m_pResultSet->Close(); It goes well (I tried it up to 5000 ).

May be your problem is the same. Try to close the open recordset before opening a new one.

Hussam