Forum Discussion

whuang's avatar
whuang
Regular Contributor
4 years ago
Solved

How can I get all records from a query?

Hi there,

 

I got TC to run a query which returns more than one records, but when I used the codes below, it complained "Could not find stored procedure 'First'.", if I comment out this line, it complained on While Not DBConnection.EOF that "Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.". Can someone please help me how I can get all the results from the list? Thanks in advance!

 

Set DBConnection = ADO.CreateConnection
DBConnection.ConnectionString = MyStringValue
DBConnection.Open

Set Result = DBConnection.Execute(QueryToRun)
DBConnection.First
While Not DBConnection.EOF
Log.Message(Result.Fields.Item(ColumnName).Value)
DBConnection.Next
Wend
DBConnection.Close

2 Replies