CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 1999
    Posts
    14

    Recordset in ADC

    Hi ,
    I want to loop thru my whole "empoyees" table:

    rs.Open "employees", , , cmdTable
    rs.MoveFirst
    Do while not rs.EOF
    ...
    rs.MoveNext

    The problem is if my table happens to be empty, right after the statement : rs.Movefirst, the program bumps. How can I control this ?

    Thanks



  2. #2
    Join Date
    May 1999
    Posts
    14

    Re: Recordset in ADC

    rs.Open "employees", , , cmdTable

    If Not rs.EOF And Not rs.BOF Then
    rs.MoveFirst
    Do while not rs.EOF
    ...
    rs.MoveNext
    Loop
    End If

    If you have at least one record, both EOF and BOF cannot be true, at the same time...


  3. #3
    Join Date
    Aug 1999
    Posts
    14

    Re: Recordset in ADO

    Hi Rufus,
    I really appreciate your reply.

    Thx


  4. #4
    Join Date
    Sep 1999
    Location
    143, Gandhi Road, Sriperumbudur, TamilNadu, India. Pin.602 105.
    Posts
    1

    Re: Recordset in ADC

    Hello Friend,

    After you open the recordset, check whether the rs.recordcount >0.
    i.e.
    If rs.recordcount>0 then
    rs.movefirst
    ..............
    .......
    endif


    Don't Worry! Be Happy!!

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