whuang
6 years agoRegular 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!
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-server-2017 and other ADO documentation provided by Microsoft.