Jump to content
PINTO1927

view result sql into array

Recommended Posts

PINTO1927

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

Share this post


Link to post
Share on other sites
PINTO1927
Quote
_MySQLConnect("sa","sa","mydb","mywebsite.com")

 

You can be an example ? which returns the result in an array table ?

Share this post


Link to post
Share on other sites
Skysnake

@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?

Share this post


Link to post
Share on other sites
PINTO1927

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 .
        

Share this post


Link to post
Share on other sites
Skysnake

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?

Share this post


Link to post
Share on other sites
PINTO1927

 

 

*** 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 ?

Share this post


Link to post
Share on other sites
PINTO1927

 

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?

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

  • Similar Content

    • Pagi
      By Pagi
       
      <a href="index.php=4143b27b41db0a40c499202865c3e24d" class="menuitem " target="\_self"> "Menu Item 1" </a>
      Can you tell me if it´s possible to click this menu button? If yes, how? Cause I have no idea, I think i should use _IETagNameGetCollection
    • mar3011
      By mar3011
      hello, I want to set in the inputbox field random key from the keyboard to which the function will be assigned, for example F4 function start notepad ALT + A function start notepad for one function. Thank you for any help.  
    • JuanFelipe
      By JuanFelipe
      Cambiar a español Hello friends, I need help with a problem I have, I want to know if there is any way to update a GUI already running, that is I have a GUI of a certain size and with a button I would like to enlarge it:
      example: $ form1 = GUICreate ("", 200,100,0,0)   When you press the button, the gui increases its size, and actuates the new size.
    • TheSaint
      By TheSaint
      Only early days at this point, but I have been pondering such a program for a while.
      As good as calibre is (thank you Kovid Goyal), which is a great and wonderful ebook suite of tools and a fair database, it does have its limitations. One of which, is how it deals with multiple libraries, another is the views you get. CalibBrowser will seek to address those.
      What CalibBrowser is not going to be, is an editor for existing calibre libraries. That will be left up to calibre, which is very much needed still, and covers many aspects I will never look at. Unlike calibre, which is quite a complex program, CalibBrowser also seeks to be simple. It is mainly a viewer, at this point, but will later be able to create its own libraries. However, it does not and will not export them to calibre, especially as calibre employs a far different method and structure to what CalibBrowser will employ.
      When CalibBrowser starts, it looks for calibre executables and the main Calibre Library. Whatever isn't found, you get prompted for with a browse option.
      A calibre library, is a set of ebook folders (Author\Ebooks) and a database file, always named metadata.db, and which causes an issue when it comes to multiple libraries, but makes life a bit easier when reconstructing any corrupted libraries. However, there are better ways to deal with that, as my program will show.
      The metadata.db file is an SQL database, so I am having a learning curve right now, as I have only ever dealt with an SQL database previously, codewise, when I created my INItoSQL program some time last year, as an exercise to prove a point.
      At the moment, things are pretty basic, and not everything works 100%. Here is a screenshot, to give an idea of it, but keep in mind, I intend to expand the current GUI for other stuff I will be adding.

      Older Screenshots
      Gawd, I just noticed the '3|7' in the Book Input field (original screenshot). I was using that during troubleshooting for the multiple images scrolling and forgot to disable it ... not that it impacts anything. When it comes to maths, I struggle a bit, especially when tired. Right scrolling was easy, with a continuous loop, was easy to implement. Left scrolling was significantly harder for my poor brain ... until I realized I needed to see them as Min and Max.
      As you can see the program is usable, and all the buttons, aside from the Program Information one, work. You can even load different calibre libraries, and even reload after making changes to one with calibre. The calibre program does not need to be running, even to view an ebook in the Calibre Reader. The combo selector for a library and the ADD button are only temporarily placed where they are, until I expand the GUI.
      My intention at this point, is to add another five thumbnail images, directly below existing. Currently they aren't clickable, but I may add that.
      Here is another screenshot, of what you see when you click the larger Cover image.

      If you want to have a play with the program as is, then you will need to also get the 'sqlite3.dll' file from some online source. When CalibBrowser starts successfully with the selected calibre library, it copies its metadata.db file to a sub-folder of the program called 'Backups'. It also creates a sub-folder in that, based on the library name, to house it. That copied file, is the one the program uses, though it does not even edit that, and file modification is checked every time the program starts with a particular library, or when you Reload or select a library. If the original source file has been modified, then the program copy is overwritten. The Reload Database button does nothing, if there is no change detected, and reports such.
      Place the required 'sqlite3.dll' file in the CalibBrowser root folder. Download includes source files (sqlite3.dll excepted).
      Also required of course, is an install of calibre, plus some ebooks in a created library - Calibre Library is the default when you first add ebooks to calibre. The Mobile Read Forums, is a great source for all things ebook, and calibre can be found there in the E-Book Software section.
      CalibBrowser.zip  - Upload 4  (previous downloads: 1 + 12 + 5)
      My apologies for the program being created in AutoIt v3.3.0.0. It is the first one I have done in a while, with an older AutoIt version. Basically my Win 7 Netbook, which has a current version of AutoIt, was busy and is always busy doing something, and not suitable for doing big projects for several reasons. My older but more powerful Win XP Laptop, has a better programming environment, better computer chair (most important for my knees etc), better external monitor (wider and newish), full size external keyboard & mouse, and a great suite of setup tools to assist me. I run several older versions of AutoIt already on my Laptop, but haven't yet determined what I need to adjust to add a current version of AutoIt to the mix. This also applies to my hugely beneficial Toolbar For Any program (one of those tools), which I constantly use with SciTE. At some point, when finished, I may update the program to the current AutoIt version ... especially as I believe I am now proficient enough to do so, having become quite familiar with it in the last year or so, making many programs with it.
      Enjoy!
       
    • BogdanNicolescu
      By BogdanNicolescu
      While 1 / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / WEnd OR:

       
      HotKeySet("{ESC}", "Terminate") While 1 MouseClick("Right",674,422) MouseClick("Left",673,447) Sleep(2000) / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / MouseClick("Left",675,339) SLeep(3000) WEnd Func Terminate()     Exit 0 EndFunc  
      Sorry if i should't let this here to be found by newbies like me -.-'
×