|
-
Jul 27th, 2000, 10:41 AM
#1
Thread Starter
Member
Hi
The following code displays the results howver the recordcount property of the ado recs recordset returns -1. There are over 100 records in the resultset!
Set Cons = New Connection
Set Recs = New Recordset
Cons.Open "provider=MSDASQL;dsn=accessextreme", "admin", ""
Recs.Open "select * from customer", Cons, adOpenDynamic, adLockOptimistic
Text1.DataField = "city"
Set Text1.DataSource = Recs
Can anyone please give help in this?
-
Jul 27th, 2000, 10:46 AM
#2
Frenzied Member
You need to loop through the data.
add the following:
If Recs.EOF = False Then 'we got a count, this will tell us
Do While Not Recs.EOF
'do something with the data retrieved
Recs.MoveNext
Loop
End If
-
Jul 27th, 2000, 10:53 AM
#3
Thread Starter
Member
Hi JH
Well I did try : recs.MoveLast and recs.MoveFirst
but even after this the recordcount value is the same = -1!
Latest: Also just now tried what you have suggested above no luck I am affraid.
[Edited by sultan on 07-27-2000 at 12:03 PM]
-
Jul 27th, 2000, 11:15 AM
#4
Frenzied Member
Heh, OOps, I missed that one.
To get the record count, you could always issue
"select count(*) from customer"
-
Jul 28th, 2000, 05:56 AM
#5
Thread Starter
Member
It didn't work, any more ideas?
This is really bewildering!
-
Jul 28th, 2000, 11:04 AM
#6
Frenzied Member
It's not going to set "recordcount" but return a value that will represent what recordcount should have.
-
Jul 28th, 2000, 11:30 AM
#7
Thread Starter
Member
Sorry What I meant was that I could not reset the recordset it complains that the recordset is already open. I know this is a silly question but, how do you feed a new select query to the already open recordset?
many thanks.
-
Jul 28th, 2000, 11:56 AM
#8
Frenzied Member
I just open/close recordsets as many times as I need them.
-
Jul 29th, 2000, 11:01 AM
#9
New Member
Here are 2 options out of some:
1) rs.open "SELECT COUNT(*) FROM mytable"
msgbox rs.fields(0) 'Your recordcount
2) On your original rs, using adOpenStatic Cursor will do the change.
Good Luke !
-
Jul 30th, 2000, 11:44 AM
#10
Guru
Open the recordset using a client side static cursor. If this does not work, it is a deficiency in your ODBC driver.
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
|