Jump to content

view result sql into array


Recommended Posts

@PINTO1927 of course you can link to SQL with AutoIt.  Look at @mLipok's ADO.UDF.  Look at the SQLite examples in the Help File.  I made a little script to illustrate a solution to a common SQLite question and repeatedly display the results in AutoIt with an Array function to illustrate what it does.

ADO.UDF to connect to SQL

SQLite example with ArrayDisplay

From the Help File: _SQLite_GetTable2d

Please provide more info if you require more assitance: type of SQL rdbms ? example of script, exampe of query etc.

 

 

 

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

Hi @Skysnake,

                  $excel = _Excel_Open(False)
                  Global $foglio = "*** PATH ***"
                  Global $lavoro = _Excel_BookOpen($excel, $foglio, Default, Default, 3)
                  $risultato = _Excel_RangeRead($lavoro, Default, $lavoro.ActiveSheet.Usedrange.Columns("A:I"), 1)
                  Global $finale[UBound($risultato)][9]
                     For $1 = 0 To UBound($risultato) - 1
                     $finale[$1][0] = $risultato[$1][0]
                     $finale[$1][1] = $risultato[$1][1]
                     $finale[$1][2] = $risultato[$1][2]
                     $finale[$1][3] = $risultato[$1][3]
                     $finale[$1][4] = $risultato[$1][4]
                     $finale[$1][5] = $risultato[$1][5]
                     $finale[$1][6] = $risultato[$1][6]
                     $finale[$1][7] = $risultato[$1][7]
                     $finale[$1][8] = $risultato[$1][8]
                     Next
                     $array = _arraydisplay($finale,'*** TITLE ***', Default, 32 + 4, Default, Default, Default, 0xDDFFDD, Default)

 

this is my script . The sql query is present in the excel sheet with a pivot . The problem is , at the time the array table , the values are not updated . so I decided to run the query directly AU3 .
        

Link to comment
Share on other sites

Are you sure the problem is with the array? What does this reference: " Global $foglio = "*** PATH ***""

Maybe the problem is with the _Excel_RangeRead - are you sure that <risultato> contains values when you return from the spreadsheet?  Place an _ArrayDisplay() directly after  "$risultato = _Excel_RangeRead($lavoro..." to see what you return?

 

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

 

the array table opens perfectly but before it does not update the contents of the excel table. You must necessarily manually open the excel file and update it or is there a way that updates the table during array creation?

Link to comment
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
 Share

×
×
  • Create New...