Ask a Question

How can I get all records from a query?

SOLVED
whuang
Regular Contributor

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 2
AlexKaras
Champion Level 2

Hi,

 

https://support.smartbear.com/testcomplete/docs/testing-with/working-with-external-data-sources/data...

https://support.smartbear.com/testcomplete/docs/testing-with/working-with-external-data-sources/data...

 

https://www.google.com/search?q=ado+recordset+iterate+records+vbscript

https://stackoverflow.com/questions/45619762/doing-stuff-for-each-record-in-a-recordset

http://www.vb-helper.com/howto_update_ado.html

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
whuang
Regular Contributor
cancel
Showing results for 
Search instead for 
Did you mean: