Sign in to follow this  
Followers 0
jdicerch

RecordSet in autoit using .mbd database

2 posts in this topic

#1 ·  Posted (edited)

I am trying to get all the values from a query, but everytime I do it only returns the first result.

When I run this query:

SELECT distinct order_id FROM ORDER_HEADERS where date_ordered = date()

It gives me 4 results in Access.

When I run it through Autoit's ADODB.RecordSet, it only gives me 1 record.  How do I iterate through and get them all?

This is what I have so far!

Thanks in advance.

Local $orderID[2]
$queryOrder = "SELECT distinct order_id FROM ORDERS where date_created = date()"
$dbnameOrder = "myDB.mdb"
$adoConOrder = ObjCreate("ADODB.Connection")
$adoConRS = ObjCreate("ADODB.RecordSet")
$adoConOrder.Open("Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & $dbnameOrder)
$adoConRS.Open($queryOrder, $adoConOrder)
$recordcount = 0

;$orderID = $adoConOrder.Execute($queryOrder)
For $Field in $adoConRS.Fields
   $recordcount +=1
   ConsoleWrite($adoConRS.Fields("ORDER_ID").Value)
Next
MsgBox(0,"",$recordcount) ;This is just to see how many records it sees (only 1)
 

Edited by jdicerch

Share this post


Link to post
Share on other sites



Never Mind.  I figured it out by adding a While Not $adoConRS.EOF before going through the fields

Thanks anyway!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0