View Full Version : vbscript & ado question
davehaz
11-09-2005, 11:17 PM
howdy,
I have a script I have written in vbs to access a mysql db using ado.
It is working, however I don't know how to cycle through adoRecordset.Field("field").value to get to the different records I have selected.
Does vbs have a while function?
How do I find out how many records were selected with my select statement?
thanks.
TheShaner
11-10-2005, 03:56 PM
Go to next record -> adoRecordset.MoveNext
Number of records -> adoRecordset.RecordCount (however, I've never really trusted this. It has bugged out on me before. Instead I'll do a separate query with a Count on the records or I'll have an incrementor count as i move through the records.)
Do
' Do stuff here
adoRecordset.MoveNext
Loop Until adoRecordset.EOF
-Shane
davehaz
11-11-2005, 10:35 AM
thanks Shane,
that got me headed where I needed to go. I couldn't get NextRecord to work either it kept giving me -1, which means there was a problem somewhere. But could not find it, I did a separate query to get a count and then just counted up to it.
thanks.
TheShaner
11-14-2005, 06:56 PM
Np! Also, the command is MoveNext to move to the next record. Usually before moving through a list of records, I do a MoveFirst to be sure I'm starting at the beginning of the recordset.
-Shane
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.