Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / April 2008



Tip: Looking for answers? Try searching our database.

I am not getting a response from the .Recordcount in ADODB.Recordset

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JohnRoy@BtConnect.com - 13 Apr 2008 08:12 GMT
Hello
I am not getting a response from the .Recordcount in ADODB.Recordset
It opens the file ok and you can see the first record but the .Recordcount
shows -1
Help Please

Set rsEmail_BusinessType = New ADODB.Recordset
rsEmail_BusinessType.Open "Email_BusinessType_Table", ConStr_For_EmailData,
adOpenStatic, adLockOptimistic, adCmdTable
With rsEmail_BusinessType
.MoveFirst
If .RecordCount > 0 Then
   Do Until .EOF = True
       Combo1.AddItem !BusinessType
       .MoveNext
    Loop
End If

End With
rsEmail_BusinessType.Close
Set rsEmail_BusinessType = Nothing
Dmitriy Antonov - 14 Apr 2008 02:24 GMT
RecordCount doesn't work with all types of cursor. Generally it works with
ClientSide Static cursor. This is officially documented in the ADO Help.
In your particular case you can just remove If statement at all, which is
just superfluous, and it will work as expected. BTW you should remove
MoveFirst because the recordset after opening is always positioned at the
first record, if any exists. Otherwise you should use a check

if not (.eof and .bof) then .MoveFirst

If you don't do it this way you will have an error if there are no records.

Dmitriy.

> Hello
> I am not getting a response from the .Recordcount in ADODB.Recordset
[quoted text clipped - 18 lines]
> rsEmail_BusinessType.Close
> Set rsEmail_BusinessType = Nothing
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.