Jump to content

RecordSet in autoit using .mbd database


Go to solution Solved by jdicerch,

Recommended Posts

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
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...