Ask a Question

How can I retrive data from ADO database?

SOLVED
whuang
Regular Contributor

How can I retrive data from ADO database?

Hi Support,

 

I had a script to run database query with no problem, but now I need to retrive data after running the query, I am not sure how to do that. I have the code below working as expected, but after the execution line, I added "Log.Message(DBConnection.Fields.Item("OrderStatusDateTime").Value)", but it doesn't work, the query returns only 1 column 1 value, can someone please tell me how I can do it?

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

DBConnection.Execute(QueryToRun)

Thanks!

2 REPLIES 2
whuang
Regular Contributor

Nevermind, it is working now

AlexKaras
Community Hero

Hi,

 

This is because you do not preserve returned result (if any) - https://www.w3schools.com/asp/met_conn_execute.asp.

Also https://docs.microsoft.com/en-us/sql/ado/reference/ado-api/execute-method-ado-connection?view=sql-se... and other ADO documentation provided by Microsoft.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] 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 Heroes]
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 Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
cancel
Showing results for 
Search instead for 
Did you mean: