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

Thread: ADO

  1. #1
    Join Date
    Aug 1999
    Posts
    45

    ADO

    Set rsTable = cnnConnection.OpenSchema(adSchemaTables)

    While Not rsTable.EOF


    lstrCommand = "select * from [" & rsTable("TABLE_NAME") & "]"
    'Open one Table
    rs.Open lstrCommand, cnnConnection, , , adCmdText

    If Not rs.EOF And Not rs.BOF Then
    call ProcessOneTable
    end if


    Wend

    --->The problem is even if my table is empty(no records), but still
    rs.EOF and rs.BOF returns False, and go to the CALL ProcessOneTable which
    I don't want.

    Thanks for help



  2. #2
    Join Date
    Apr 1999
    Posts
    49

    Re: ADO

    Maybe you forgot to move to the next record in your loop
    i.e. :

    While Not rsTable.EOF

    ...
    rsTable.MoveNext

    Wend

    Tip : you can use this line to open your recordset

    rs.Open rsTable("TABLE_NAME"), cnnConnection,,, adCmdTable


    Marc


  3. #3
    Join Date
    Aug 1999
    Posts
    45

    Re: ADO

    Hi Marc,

    I did have the rsTable.MoveNext
    and the it loops thru all the tables fine,
    but still it does not recognize an empty table

    Thanks for your help


  4. #4
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: ADO

    Is it possible that something isn't closing your recordset object (rs) ?

    Have you got more code than this going on somewhere (especially an 'On Error Resume Next' statement ) ?

    Try doing an rs.close just before the Wend statement.



    Chris Eastwood

    CodeGuru - the website for developers
    http://www.codeguru.com/vb

  5. #5
    Join Date
    Aug 1999
    Posts
    45

    Re: ADO

    I've made my code as simple as this, no Error Resume Next at all, but still....


    While Not rsTable.EOF
    rs.Open rsTable("TABLE_NAME"), cnnConnection, , , adCmdTable

    If Not rs.EOF And Not rs.BOF Then
    Kathy
    End If

    rs.Close
    rsTable.MoveNext

    Wend


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