CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    ODBC recordset loop executes only 200 times???

    reply at [email protected]

    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();

    }



  2. #2
    Join Date
    Apr 1999
    Location
    Norway
    Posts
    19

    Re: ODBC recordset loop executes only 200 times???

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured