Sign in to follow this  
Followers 0
dar100111

SQLite newbie help

3 posts in this topic

Hey All!

How can I take my resuts from my $aResult query and turn into an array so that I can have my list show the results?  It's pulling back my query results and putting into the console.

I just wasn't sure how to turn into an array so I can _ArrayDisplay

Thanks!

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=mcw.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.8.1
 Author:         myName

 Script Function:
    MID CODE WIZARD

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
#include <Array.au3>

$ORACLE_DB_PATH = "F:\EI\DFW\BPM\SQLite\ORACLE\ORACLE"


#Region ### START Koda GUI section ### Form=c:\users\dfw-danielro\documents\autoit scripts\multi-input-listview.kxf
_SQLite_Startup()
_SQLite_Open($ORACLE_DB_PATH)
$MCW = GUICreate("MCW", 370, 267, 338, 171)
GUISetFont(8, 400, 0, "MS UI Gothic")
$title = GUICtrlCreateLabel("Mid Code Wizard", 96, 0, 163, 28, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, 14, 800, 0, "@Microsoft JhengHei UI")
GUICtrlSetColor(-1, 0x000000)
$results_list = GUICtrlCreateList("", 16, 176, 233, 83)
$a = GUICtrlCreateInput("", 120, 40, 100, 19, $GUI_SS_DEFAULT_INPUT)
$b = GUICtrlCreateInput("", 120, 64, 100, 19, $GUI_SS_DEFAULT_INPUT)
$c = GUICtrlCreateInput("", 120, 88, 100, 19, $GUI_SS_DEFAULT_INPUT)
$d = GUICtrlCreateInput("", 120, 112, 100, 19, $GUI_SS_DEFAULT_INPUT)
        $Label1 = GUICtrlCreateLabel("Country", 16, 40, 54, 21, BitOR($SS_RIGHT,$SS_CENTERIMAGE))
        GUICtrlSetFont(-1, 10, 800, 0, "@Microsoft JhengHei UI")
        $Label2 = GUICtrlCreateLabel("Manufacturer", 16, 64, 89, 21, BitOR($SS_RIGHT,$SS_CENTERIMAGE))
        GUICtrlSetFont(-1, 10, 800, 0, "@Microsoft JhengHei UI")
        $Label3 = GUICtrlCreateLabel("City", 16, 88, 29, 21, BitOR($SS_RIGHT,$SS_CENTERIMAGE))
        GUICtrlSetFont(-1, 10, 800, 0, "@Microsoft JhengHei UI")
        $Label4 = GUICtrlCreateLabel("Address #", 16, 112, 64, 21, BitOR($SS_RIGHT,$SS_CENTERIMAGE))
        GUICtrlSetFont(-1, 10, 800, 0, "@Microsoft JhengHei UI")
        $search = GUICtrlCreateButton("Search", 248, 40, 89, 25, $BS_FLAT)
        GUICtrlSetFont(-1, 10, 400, 0, "@Microsoft JhengHei UI")
        $sug_label = GUICtrlCreateLabel("", 128, 56, 4, 4, BitOR($SS_CENTER,$SS_CENTERIMAGE,$SS_SUNKEN))
        $Label6 = GUICtrlCreateLabel("", 128, 56, 4, 4)
        $Label5 = GUICtrlCreateLabel("Suggested Mid Code", 240, 72, 113, 18, BitOR($SS_CENTER,$SS_CENTERIMAGE))
        GUICtrlSetFont(-1, 8, 800, 0, "@Microsoft JhengHei UI")
        $Label7 = GUICtrlCreateLabel("Enter Fields above and Search for existing Mid Code", 16, 152, 274, 18, BitOR($SS_CENTER,$SS_CENTERIMAGE))
        GUICtrlSetFont(-1, 8, 400, 0, "@Microsoft JhengHei UI")
        $Label8 = GUICtrlCreateLabel("", 236, 104, 116, 28, BitOR($SS_CENTER,$SS_CENTERIMAGE,$SS_SUNKEN))
        GUICtrlSetFont(-1, 10, 400, 0, "MS UI Gothic")
        $Button1 = GUICtrlCreateButton("Create New", 264, 208, 81, 49)
        GUICtrlSetFont(-1, 8, 400, 0, "@Microsoft JhengHei UI")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    Local $aResult, $iRows, $iColumns, $iRval

    $nMsg = GUIGetMsg()

    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $search


            If ControlGetText($MCW, "", $a) = "" Then
                MsgBox("Enter Info", "Missing Info", "Please fill out at least one field to query")
            else
            $ent_country = StringUpper(ControlGetText($MCW, "", $a))
            _SQLite_GetTable2d(-1, "SELECT * FROM LOCATION_REFS WHERE COUNTRY = "&"'"&$ent_country&"'", $aResult, $iRows, $iColumns)
            _SQLite_Display2DResult($aResult)
            EndIf
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites



dar100111,

Assuming that _SQLite_GetTable2D ran correctly your array is in variable $aResult (see Help file).

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

Hey Bohica!

Yeah you are right.  I tried and must have had another syntax problem because it didn't display.  I went back and checked and it is indeed working.  Thanks!

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