Click to See Complete Forum and Search --> : ADO


Kathy
August 23rd, 1999, 03:47 PM
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

Marc L'Ecuyer
August 24th, 1999, 07:55 AM
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

Kathy
August 24th, 1999, 08:15 AM
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

Chris Eastwood
August 24th, 1999, 08:36 AM
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

Kathy
August 24th, 1999, 09:02 AM
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