PINTO1927 Posted May 23, 2016 Posted May 23, 2016 Hi guys, You can run a sql query in a script of autoit ? I would like to see the result in an array table .. Thank's
AutoBert Posted May 23, 2016 Posted May 23, 2016 Have a look at https://www.autoitscript.com/wiki/User_Defined_Functions#Databases_and_web_connections or for SQLite in the helpfile: _SQLite_GetTable2d
PINTO1927 Posted May 23, 2016 Author Posted May 23, 2016 Quote _MySQLConnect("sa","sa","mydb","mywebsite.com") You can be an example ? which returns the result in an array table ?
Skysnake Posted May 23, 2016 Posted May 23, 2016 @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?
PINTO1927 Posted May 23, 2016 Author Posted May 23, 2016 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 .
Skysnake Posted May 23, 2016 Posted May 23, 2016 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?
PINTO1927 Posted May 23, 2016 Author Posted May 23, 2016 *** PATH **** the path where the excel file. it's correct. I Submitted ArrayDisplay ( ) and I returns the same result. there is another way to achieve the same result ?
PINTO1927 Posted May 24, 2016 Author Posted May 24, 2016 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?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now