Jump to content

QDBCquery application

Recommended Posts

Small application in autoit for doing QDBC queries


- menu functions are now all functioning

- changed variablenames and added more comments

- added cliboard and save to file for results.

- window resizing now corrected, final bug will be fixed in


- further improve catalog layout.

You can download the latest version here : http://www.autoitscript.com/fileman/users/HansH/ODBCquery.au3

Have fun


Link to post
Share on other sites
  • 11 months later...
  • 5 months later...
  • Moderators

I thought this script was great! Too bad it doesn't work with the latest beta :P

Latest Beta? I didn't know there was a Beta, there's the release version I believe.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to post
Share on other sites

Hi, looks interesting, unfortunately its not working for me using latest distribution 3.2.2

Ran a syntax check in Scite which returned a few line feed errors but still nothings happening.

It would be nice to see a short description of what this script does or requires, i'm new here but have downloaded a few scripts to find out what they do because of insufficient description, quite a few times i've had to search for an include file like excelcom.au3 and in one case found all the required files then lol : msgbox "Sorry this does'nt work for office 2000, bad luck" :P

Ok, now thats off my chest, thanx to the creators and contributors of autoit for a great product!

I've been playing around with it for couple of days now and finding it more and more useful.

I'm a begginer obviously but put together a simple access dbviewer - ie, no table reationships and limited error handling.

Basically, click file open to open an msaccess db and view its tables, click a table to view its records...

#include <GUIConstants.au3>
#include <GuiList.au3>
#Include <GuiListView.au3>

opt ("MustDeclareVars", 1)
Dim $gui = GUICreate("DB Viewer", 800, 600)
Dim $filemenu = GUICtrlCreateMenu ("&File")
Dim $fileitem = GUICtrlCreateMenuitem ("Open",$filemenu)
Dim $tablesLabel, $tablesButton, $fieldsList
Global $tablesList
Global $objConn
Dim $file , $msg

Func DB_Open($file)
If Not $tablesLabel Then $tablesLabel=GUICtrlCreateLabel  ("Tables", 10,10)
If Not $tablesList Then 
    $tablesList=GUICtrlCreateList ("", -1,25,120 ,97)
$objConn = ObjCreate("ADODB.Connection")
$objConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & $file & ";")
 Dim $rsTables = $objConn.OpenSchema(20)
With $rsTables
    While Not .EOF
    If .Fields("TABLE_TYPE").Value == "TABLE" Then  GUICtrlSetData($tablesList,.Fields("TABLE_NAME").Value)
;If Not $tablesButton then $tablesButton        = GUICtrlCreateButton("View", 10, 125, 50)

Func Table_Open($file, $menustate)
Dim $headerFields
Dim $reclist
$objConn = ObjCreate("ADODB.Connection")
$objConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & $file & ";")
Dim $rsFields = $objConn.Execute("SELECT * FROM " & $menustate)
Dim $i
For $i = 0 to $rsFields.Fields.count - 1
            $headerFields&=$rsFields.fields($i).name & "|"
If $fieldsList then 
    _GUICtrlListViewDeleteAllItems ($fieldsList)
$fieldsList=GUICtrlCreateListView ($headerFields, 170,25,600 ,250)
    While Not $rsFields.EOF
    For $i = 0 to $rsFields.Fields.count - 1
            $reclist&=$rsFields.fields($i).value & "|"
        GUICtrlCreateListViewItem($reclist, $fieldsList)

GUISetState ()

    $msg = GUIGetMsg()
        if $msg == $tablesList Then
        Dim $menustate  = GUICtrlRead($tablesList) 
        If $menustate Then
        Dim $menutext   = GUICtrlRead($tablesList, 1) 
        Table_Open($file, $menustate)
;if $msg == $tablesList then MsgBox(0,"listview", "clicked="& GUICtrlRead($tablesList, 1))
    If $msg = $fileitem Then
        $file = FileOpenDialog("Choose file...",@ScriptDir,"Microsoft Acces Databases (*.mdb)")
        If @error <> 1 Then DB_Open($file)
Until $msg = $GUI_EVENT_CLOSE
Edited by Will66
Link to post
Share on other sites
  • 5 months later...
  • 2 weeks later...

the code hangs up for me at the call for ODBCsources() . any ideas why ?

Try replacing the ODBCsources function with this one:

Func ODBCsources($h_controlID, $s_RegEntry, $s_Type)
    Local $s_List, $i_dsncount, $s_VarNm, $s_Value, $i
    $i = 1
    $s_VarNm = RegEnumVal($s_RegEntry,  $i)
    $s_Value = RegRead($s_RegEntry, $s_Varnm)
    While $s_VarNm <> ("No more data is available." & @CRLF)
        $s_VarNm = RegEnumVal($s_RegEntry,  $i)
        $s_Value = RegRead($s_RegEntry, $s_Varnm)
        If $s_Varnm <> ("No more data is available." & @CRLF) Then
            GUICtrlCreateListViewItem($s_VarNm & "|" & $s_Type & "|" & $s_Value, $h_controlID)
            $i += 1
            $i_DSNcount += 1
Link to post
Share on other sites
  • 1 month later...

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...