HELP: Recordcount always -1 (using adOpenKeyset)

  • Thread starter Thread starter VB Programmer
  • Start date Start date
V

VB Programmer

I cannot get my recordcount to show up properly (using ADO 2.5). It keeps
showing -1!

Here's a snippet:
Dim dbMyDb As New ADODB.Connection
Dim rsWebData As New ADODB.Recordset

dbMyDb.Open gConnectionString

rsWebData.Open "SELECT * FROM WebDataLogAc;", dbMyDb, adOpenKeyset,
adLockOptimistic
rsWebData.MoveFirst
Debug.Print rsWebData.RecordCount

This always returns -1 even though there are records in the table. HELP!!!
Thanks!
 
I cannot get my recordcount to show up properly (using ADO 2.5). It
keeps showing -1!

Here's a snippet:
Dim dbMyDb As New ADODB.Connection
Dim rsWebData As New ADODB.Recordset

dbMyDb.Open gConnectionString

rsWebData.Open "SELECT * FROM WebDataLogAc;", dbMyDb,
adOpenKeyset,
adLockOptimistic
rsWebData.MoveFirst
Debug.Print rsWebData.RecordCount

This always returns -1 even though there are records in the table.
HELP!!! Thanks!

ADO.NET is not the same as ADO. It is not just a new version of ADO. It
is a total shift in how data access is done. You would get a better
answer on using ADO in an ADO newsgroup. Try:

microsoft.public.data.ado
 
Thanks. I posted to this group by accident.

It turns out the db (MSDE) was acting screwy. I recreated it and my code
worked!
 
Back
Top