|
-
Jun 2nd, 2000, 12:33 AM
#1
Thread Starter
Junior Member
How can I get the record count value in an ADODB.Recordset object? It always returns a -1. Thanks.
-
Jun 2nd, 2000, 12:46 AM
#2
You have to change the CursorLocation property to adUseClient before you open your recordset.
-
Jun 2nd, 2000, 12:48 AM
#3
Lively Member
Have you tried using anything similar to this?
Code:
Dim cnn As Connection
Dim rs As Recordset
Dim rc As String
.....
.......
Set rs = New Recordset
rs.Open
rc = rs.RecordCount
Label1.Caption = rc
rs.Close
Dr_Evil
Senior Programmer
VS6 EE
VS.NET EA
-
Jun 2nd, 2000, 12:49 AM
#4
Addicted Member
I've noticed that setting the ADO Recordset cursor to Static will return a record count (which makes sense, if the recordset changes, how can you count it?)
Code:
adoRset.Open "table", adoConn, adOpenStatic, adLockReadOnly
-
Jun 2nd, 2000, 01:33 AM
#5
Hyperactive Member
Use either adOpenKeyset or adOpenStatic as the CursorType for server side cursors, or use a client side cursor (since client side cursors use only adOpenStatic for CursorTypes).
-
Jun 2nd, 2000, 02:03 AM
#6
Thread Starter
Junior Member
I'm opening the recordset with this statement:
Rst.Open "SELECT * FROM <TABLE>", Conn, adOpenDynamic, adLockOptimistic, adCmdText
Have tried Serge's tip and it worked! Thanks Serge and to the others who gave their tips....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|