Jump to content
GreenCan

ActiveX Data Objects - DSN-Less Database connection demo

Recommended Posts

GreenCan

This is an example how to access/query different kind of Databases with AutoIt.  The demo contains also test Databases, so the script functions for most of the provided database connections.

Databases covered here:

  • Oracle (no demo database for this one)
  • MS SQL Server (no demo database for this one)
  • SQLite (requires installation of the SQLite ODBC driver software available here: http://www.ch-werner.de/sqliteodbc/ )

Of course SQLite is natively available in AutoIt but in some cases it might be preferable to use the ODBC approach accessing the database via the same scripted method, for example if you use different Databases in the same script, it is much easier to code.

  • Excel
  • DBase DBF
  • MS Access
  • CSV Text driver (semicolon delimited and comma delimited)

The example script is based on Kinshima’s Oracle SQL example . I like the Dim by pack method, much better than redim one row at the time, which too slow.

All the databases have the same data content (‘Timeline_of_space_exploration’)  to keep the examples similar for every database.

The result of each SQL will be displayed in Arraydisplay, togheter with a window containing the ADO-less connection string (yellow) and SQL.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Comment=Comprehensive DSN-Less Database connection demo
#AutoIt3Wrapper_Res_Description=DSN-Less Database connection demo
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=GreenCan
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <array.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>

Opt('MustDeclareVars', 1)

Global $oODBC_Connection = ObjCreate("ADODB.Connection")
Global $oODBC_RecordSet = ObjCreate("ADODB.Recordset")
Global $bODBC_conn = False
Global $oErrADODB = ObjEvent("AutoIt.Error", "_ErrADODB")
Global $bConn_error = False

Global $sConnectionString, $sSQL

Global Const $iDark_Blue = 0x2601D3
Global Const $iLight_Green = 0xEAFFE8
Global Const $iYellow = 0xFFFF99

; setup GUI to display SQL
Global $hGUI_View_SQL = GUICreate("SQL", 500, 500, 10, 10, $WS_CAPTION);, $WS_EX_TOPMOST)
Global $hConnString = GUICtrlCreateEdit("", 5, 3, 490, 38, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_WANTRETURN, $WS_HSCROLL))
GUICtrlSetColor(-1, $iDark_Blue)
GUICtrlSetBkColor(-1, $iYellow)
Global $ViewSQL = GUICtrlCreateEdit("", 5, 45, 490, 450, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY, $ES_WANTRETURN, $WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetColor(-1, $iDark_Blue)
GUICtrlSetBkColor(-1, $iLight_Green)
GUISetState()

#========== Demo =============
Global $sDatabaseLocation = @ScriptDir & "\TestDatabases"

#========== Oracle =============
;~ #cs
;~ Not demo-able except if you have an Oracle instance
;~ #ce

$sConnectionString = 'DRIVER={Oracle in OraClient11g_home1};DBQ=myDatabase.world;uid=myUserID;pwd=myPassword;'
$sSQL = 'SELECT sysdate AS "Sysdate Raw", to_char(sysdate, ''Dy DD/MM/YY HH24:MI'') AS "Now" FROM dual'
Format_SQL($sSQL, $sConnectionString)
MsgBox(0,"Oracle SQL","You require to have access to an Oracle instance and modify the connection string before proceeding without error." & @CRLF & "The current Connection string will generate a COM error.")
Query($sConnectionString, $sSQL, 500, "SQL Oracle")

#========== MS SQL Server =============
MsgBox(0,"MS SQL Server","You require to have access to a SQL Server instance and modify the connection string before proceeding without error." & @CRLF & "The current Connection string will generate a COM error.")
$sConnectionString = 'DRIVER={SQL Server};SERVER=ServerNameorIP;DATABASE=DatabaseServer;Trusted_Connection=no;uid=myUserID;pwd=myPassword;'
$sSQL = 'SELECT 18 AS "Circle Radius",round(PI() * power(18,2) ,3) AS "Surface of circle", round(PI() * 18 * 2,3) AS "Circumference of circle"'
Format_SQL($sSQL, $sConnectionString)
Query($sConnectionString, $sSQL, 500, "MS SQL Server")

#========== SQLite =============
#cs
Accessing SQLite via ODBC requires installation of the SQLite ODBC driver software available here:
http://www.ch-werner.de/sqliteodbc/

Note: You will have to install the 32-bit driver,  as far as I could test, x6' version, sqliteodbc_w64 doesn't function on my x64 Windows

You can access SQLite natively FROM AutoIt
    For example look at my topics
        - SQLite Report generator
            http://www.autoitscript.com/forum/topic/149767-sqlite-report-generator/#entry1068258
        - SQLite demonstration of native recognition of BLOB object in Listview
            http://www.autoitscript.com/forum/topic/150876-sqlite-demonstration-of-native-recognition-of-blob-object-in-listview/#entry1078492
#ce
$sConnectionString = 'DRIVER=SQLite3 ODBC Driver;Database=' & $sDatabaseLocation & '\Timeline_of_space_exploration.xdb;LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;'
;~ $sConnectionString = 'DRIVER=SQLite3 ODBC Driver;Database=D:\SQLite\Netline.db;LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;'
$sSQL = 'SELECT * FROM space_exploration;'
Format_SQL($sSQL, $sConnectionString)
Query($sConnectionString, $sSQL, 500, "SQLite")

#========== Excel =============
#cs
The sheet range to be queried has a name defined AS SpaceTable
Check the Excel sheet by selecting all (Ctrl-A)
#ce
$sConnectionString = 'DRIVER={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};dbq=' & $sDatabaseLocation & '\Timeline_of_space_exploration.xlsx;'
$sSQL = 'SELECT Format (Date, ''dd-MM-yyyy'') AS "Event", Mission_Achievements AS "Mission Achievements", Country, Organization, Mission_Name AS "Mission Name" ' & _
    ' FROM SpaceTable ORDER BY Date'
Format_SQL($sSQL, $sConnectionString)
Query($sConnectionString, $sSQL, 500, "SQL Microsoft Excel")

#========== DBase DBF =============
#cs
Old Borland/Clipper Database
#ce
$sConnectionString = 'DRIVER={Microsoft dBase Driver (*.dbf)};Dbq='& $sDatabaseLocation & ';'
$sSQL = 'SELECT Format (DATE, ''dd MMM yyyy'') AS "Event", MISSION AS "Mission Achievements", Country, ORG AS "Organization", MNAME AS "Mission Name" ' & _
    ' FROM SPACE.DBF WHERE (((DATE) Between #22/04/1900# And #22/04/2015# +1)) AND UCASE(Country) <> ''USA'' ORDER BY Date'
Format_SQL($sSQL, $sConnectionString)
Query($sConnectionString, $sSQL, 500, "SQL DBase")

#========== MS Access =============
#cs
The MSAccess Example.mdb is protected with following password:
    DatabaseSQL
#ce
$sConnectionString = 'DRIVER={Microsoft Access Driver (*.mdb)};Dbq=' & $sDatabaseLocation & '\Example.mdb;uid=;pwd=DatabaseSQL;'
$sSQL = 'SELECT Format (Date, ''dd MMM yyyy'') AS "Event", Mission_Achievements AS "Mission Achievements", Country, Organization, Mission_Name AS "Mission Name" ' & _
    ' FROM  Timeline_of_space_exploration WHERE (((Date) Between #22/04/1900# And #22/04/2015# +1)) ORDER BY Date'
Format_SQL($sSQL, $sConnectionString)
Query($sConnectionString, $sSQL, 500, "SQL MS Access")

#========== CSV Text driver, semicolon delimited =============
#cs
Some variations of the same SQL

requires schema.ini in the same folder AS the text file
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms709353(v=vs.85).aspx

schema.ini settings:
    [Timeline_of_space_exploration_semicolon.txt]
    ColNameHeader=True
    Format=Delimited(;)
    MaxScanRows=1
#ce

$sConnectionString = 'DRIVER={Microsoft Text Driver (*.txt; *.csv)};Dbq=' & $sDatabaseLocation & ';Extensions=asc,csv,tab,txt;'

$sSQL = 'SELECT Format (Date, ''dd MMM yyyy'') AS "Event", Mission_Achievements AS "Mission Achievements", Country, ' & _
    'Organization, Mission_Name AS "Mission Name" FROM Timeline_of_space_exploration_semicolon.txt ORDER BY Date'
Format_SQL($sSQL, $sConnectionString)
Query($sConnectionString, $sSQL, 500, "SQL Text semicolon delimited")

#========== CSV Text driver, comma delimited =============
#cs
schema.ini settings:
    [Timeline_of_space_exploration.csv]
    ColNameHeader=True
    Format=Delimited(,)
    DecimalSymbol=.
    MaxScanRows=1
#ce

$sSQL = 'SELECT Format (Date, ''dd MMM yyyy'') AS "Event", Mission_Achievements AS "Mission Achievements", Country, ' & _
    'Organization, Mission_Name AS "Mission Name" FROM Timeline_of_space_exploration.csv ORDER BY Date'
Query($sConnectionString, $sSQL, 500, "SQL Text comma delimited")

; USA only
$sSQL = 'SELECT Format (Date, ''dd MMM yyyy'') AS "Event", Mission_Achievements AS "Mission Achievements", Country, ' & _
    'Organization, Mission_Name AS "Mission Name" FROM Timeline_of_space_exploration.csv WHERE (((Date) Between #22/04/1900# And #22/04/2015# +1)) and UCASE(Country) = ''USA'''
Format_SQL($sSQL, $sConnectionString)
Query($sConnectionString, $sSQL, 500, "SQL Text comma delimited - USA Only")
#========== End Demo =============

Exit

Func Query($sConnectionString, $sSQL, $iMaxRows, $sTitle)
    If _ODBC_OpenConnection($sConnectionString) Then

        Local $aRecords = _ODBC_GetRecords($sSQL, 500, $iMaxRows)
        _ODBC_CloseConnection()

        ; set header string
        Local $sHeader = ""
        For $i = 0 to UBound($aRecords, 2) - 1
            $sHeader &= $aRecords[0][$i] & "|"
        Next
        $sHeader = StringTrimRight($sHeader, 1) ; trim of last separator
        _ArrayDisplay($aRecords, _
            $sTitle & " - " & "Query result: " & UBound($aRecords)-1 & " rows" & (UBound($aRecords)-1 = $iMaxRows ? " (result limited to " & $iMaxRows & " rows)" : "")  , _
            "1:" & UBound($aRecords)-1, _
            0, _
            Default, _
            $sHeader)
    EndIf
EndFunc   ;==>Query

Func _ExeSQL($sSQL)
    If Not IsObj($oODBC_Connection) Then Return -1
    $oODBC_Connection.Execute($sSQL)
    If $oErrADODB.number Then
        MsgBox($MB_YESNO + $MB_ICONERROR + $MB_DEFBUTTON2, "_ExeSQL", $sSQL & @CRLF & @CRLF & 'Error. ' & @CRLF & 'Exiting.')
        Exit
    Else
        Return 1
    EndIf
EndFunc   ;==>_ExeSQL

Func _ODBC_CloseConnection()
    $bODBC_conn = False
    Return $oODBC_Connection.Close
EndFunc   ;==>_ODBC_CloseConnection

Func _ODBC_OpenConnection($sConnectionString)
    If Not IsObj($oODBC_Connection) Then Return -1
    If Not @Compiled Then ConsoleWrite ("@@ Debug(" & @ScriptLineNumber & ") : " & $sConnectionString & @CR)

    $oODBC_Connection.ConnectionString = ($sConnectionString)
    $bConn_error = False
    $oODBC_Connection.Open
    If $bConn_error = True Then
        Return False
    EndIf
    $bODBC_conn = True
    Return True
EndFunc   ;==>_ODBC_OpenConnection

Func _ODBC_GetRecords($sSQL, $iArrayIncrement = 250, $iRows = 0)
    ; syntax: _ODBC_GetRecords(SQL, ArrayIncrement, MaxRows)
    If Not $bODBC_conn Then
        MsgBox($MB_OK, 'Error', 'Connection failure')
        Return
    EndIf
    If $iArrayIncrement = 0 Then $iArrayIncrement = 250
    If Not IsObj($oODBC_Connection) Then Return -1
    If Not IsObj($oODBC_RecordSet) Then Return -2
    _ODBC_OpenRecordset($sSQL)
    Local $aRecords[1][1]
    If $oODBC_RecordSet.EOF = True Then
        _ODBC_CloseRecordSet()
        Return False
    EndIf
    $oODBC_RecordSet.MoveFirst
    Local $x = 0
    ReDim $aRecords[1][$oODBC_RecordSet.Fields.Count]
    For $objField In $oODBC_RecordSet.Fields
        $aRecords[0][$x] = $objField.Name
        $x += 1
    Next
    Local $iAIn = UBound($aRecords) + $iArrayIncrement
    ReDim $aRecords[$iAIn][$oODBC_RecordSet.Fields.Count]
    $oODBC_RecordSet.MoveFirst
    Local $y = 0
    Do
        $x = 0
        $y += 1
        For $objField In $oODBC_RecordSet.Fields
            $aRecords[$y][$x] = $objField.Value
            $x += 1
        Next
        If $y = $iAIn - 1 Then
            $iAIn += $iArrayIncrement
            ReDim $aRecords[$iAIn][$oODBC_RecordSet.Fields.Count]
        EndIf
        $oODBC_RecordSet.MoveNext
        If $iRows > 0 Then
            If $y = $iRows Then
                ;_ArrayDisplay($aRecords, @ScriptLineNumber)
                ReDim $aRecords[$y + 1][$oODBC_RecordSet.Fields.Count]
                ;_ArrayDisplay($aRecords, @ScriptLineNumber)
                Return $aRecords
            EndIf
        EndIf
    Until $oODBC_RecordSet.EOF
    ReDim $aRecords[$y + 1][$oODBC_RecordSet.Fields.Count]
    _ODBC_CloseRecordSet()
    Return $aRecords
EndFunc   ;==>_ODBC_GetRecords

Func _ODBC_OpenRecordset($sSQL);
    If Not IsObj($oODBC_Connection) Then Return -1
    If Not IsObj($oODBC_RecordSet) Then Return -2
    Return $oODBC_RecordSet.Open($sSQL, $oODBC_Connection, 0, 1)
EndFunc   ;==>_ODBC_OpenRecordset

Func _ODBC_CloseRecordSet()
    Return $oODBC_RecordSet.Close
EndFunc   ;==>_ODBC_CloseRecordSet

Func _ErrADODB()
    MsgBox($MB_ICONWARNING, "ADODB COM Error", "We intercepted a COM Error !" & @CRLF & @CRLF & _
            "err.description is: " & @TAB & $oErrADODB.description & @CRLF & _
            "err.windescription:" & @TAB & $oErrADODB.windescription & @CRLF & _
            "err.number is: " & @TAB & Hex($oErrADODB.number, 8) & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oErrADODB.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oErrADODB.scriptline & @CRLF & _
            "err.source is: " & @TAB & $oErrADODB.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oErrADODB.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oErrADODB.helpcontext _
            )
        ConsoleWrite($oErrADODB.description & @CR)
    $bConn_error = True
    Return SetError(@error, @error, 1)
EndFunc   ;==>_ErrADODB

Func Format_SQL($sSQL, $sConnectionString)
    ; format SQL script a bit
    ; the formating does not consider UNION,
    Local $stempSQL, $sSQLPart1, $sSQLPart2, $sSQLPart3, $sSQLPart4, $sSQLPart5, $sSQLPart6
    $stempSQL = $sSQL

    ; LIMIT - should be after FROM !
    If StringInStr($stempSQL, "LIMIT", 0, -1) > 0 Then
        If StringInStr($stempSQL, "LIMIT", 0, -1) > StringInStr($stempSQL, "FROM", 0, -1) Then
            $sSQLPart6 = @CRLF & "LIMIT" & @CRLF & @TAB & StringTrimLeft($stempSQL, StringInStr($stempSQL, "LIMIT", 0, -1) + 5)
            $stempSQL = StringStripWS(StringTrimRight($stempSQL, StringLen($stempSQL) - StringInStr($stempSQL, "LIMIT", 0, -1) + 1), 2)
        EndIf
    EndIf

    ; ORDER BY - should be after FROM !
    If StringInStr($stempSQL, "ORDER BY", 0, -1) > 0 Then
        If StringInStr($stempSQL, "ORDER BY", 0, -1) > StringInStr($stempSQL, "FROM", 0, -1) Then
            $sSQLPart5 = @CRLF & "ORDER BY" & @CRLF & @TAB & StringTrimLeft($stempSQL, StringInStr($stempSQL, "ORDER BY", 0, -1) + 8)
            $stempSQL = StringStripWS(StringTrimRight($stempSQL, StringLen($stempSQL) - StringInStr($stempSQL, "ORDER BY", 0, -1) + 1), 2)
        EndIf
    EndIf

    ; GROUP BY - should be after FROM !
    If StringInStr($stempSQL, "GROUP BY", 0, -1) > 0 Then
        If StringInStr($stempSQL, "GROUP BY", 0, -1) > StringInStr($stempSQL, "FROM", 0, -1) Then
            $sSQLPart4 = @CRLF & "GROUP BY" & @CRLF & @TAB & StringTrimLeft($stempSQL, StringInStr($stempSQL, "GROUP BY", 0, -1) + 8)
            $stempSQL = StringStripWS(StringTrimRight($stempSQL, StringLen($stempSQL) - StringInStr($stempSQL, "GROUP BY", 0, -1) + 1), 2)
        EndIf
    EndIf

    ; WHERE - should be after FROM !
    If StringInStr($stempSQL, "WHERE", 0, -1) > 0 Then
        If StringInStr($stempSQL, "WHERE", 0, -1) > StringInStr($stempSQL, "FROM", 0, -1) Then
            $sSQLPart3 = @CRLF & "WHERE" & @CRLF & @TAB & StringTrimLeft($stempSQL, StringInStr($stempSQL, "WHERE", 0, -1) + 5)
            $stempSQL = StringStripWS(StringTrimRight($stempSQL, StringLen($stempSQL) - StringInStr($stempSQL, "WHERE", 0, -1) + 1), 2)
        EndIf
    EndIf

    ; INNER JOIN
    If StringInStr($stempSQL, "INNER JOIN", 0, -1) > 0 Then
        $stempSQL = StringReplace($stempSQL, "INNER JOIN", @CRLF & @TAB & @TAB & "INNER JOIN")
    EndIf

    ; FROM
    If StringInStr($stempSQL, "FROM", 0, -1) > 0 Then
        $sSQLPart2 = @CRLF & "FROM" & @CRLF & @TAB & StringTrimLeft($stempSQL, StringInStr($stempSQL, "FROM", 0, -1) + 4)
        $stempSQL = StringStripWS(StringTrimRight($stempSQL, StringLen($stempSQL) - StringInStr($stempSQL, "FROM", 0, -1) + 1), 2)
    EndIf

    ; SELECT
    If StringInStr($stempSQL, "SELECT", 0, 1) > 0 Then
        $sSQLPart1 = "SELECT" & @CRLF & @TAB & StringReplace(StringReplace(StringTrimLeft($stempSQL, StringInStr($stempSQL, "SELECT", 0, 1) + 6),", ", ",") , ",", ","  & @CRLF & @TAB)
        $stempSQL = StringStripWS(StringTrimRight($stempSQL, StringLen($stempSQL) - StringInStr($stempSQL, "SELECT", 0, 1) + 1), 2)
    EndIf
    GUICtrlSetData ( $hConnString, $sConnectionString)
    GUICtrlSetData ( $ViewSQL, $sSQLPart1 & $sSQLPart2 & $sSQLPart3 & $sSQLPart4 & $sSQLPart5 & $sSQLPart6 & @CRLF )
EndFunc   ;==>Format_SQL

Script and database packs

SQL demo DSN-less connections (multi-DB).zip

GreenCan

Edited by GreenCan
  • Like 2

Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites
mLipok

It looks very good.

I'll check this in comming days.

mLipok


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-03-17

Share this post


Link to post
Share on other sites
GreenCan

It looks very good.

I'll check this in comming days.

mLipok

Thank you mLipok, let me know if you have other database ADO-less ideas...


Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites
spudw2k

Can you explain what you mean by ADO-less?  Aren't you using ADO to connect to ODBC?

Global $oODBC_Connection = ObjCreate("ADODB.Connection")
Global $oODBC_RecordSet = ObjCreate("ADODB.Recordset")

Share this post


Link to post
Share on other sites
GreenCan

 

Can you explain what you mean by ADO-less?  Aren't you using ADO to connect to ODBC?

Global $oODBC_Connection = ObjCreate("ADODB.Connection")
Global $oODBC_RecordSet = ObjCreate("ADODB.Recordset")

of course, you are fully correct, I should have written DSN-less connection, this type of connection is using ODBC indeed. 

thanks for the correction.

unfortunately, I cannot change the title of the topic anymore...

GreenCan

Edited by GreenCan

Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites
mLipok

unfortunately, I cannot change the title of the topic anymore...

 

Why ?


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-03-17

Share this post


Link to post
Share on other sites
spudw2k

of course, you are fully correct, I should have written DSN-less connection, this type of connection is using ODBC indeed. 

thanks for the correction.

unfortunately, I cannot change the title of the topic anymore...

GreenCan

I believe you can change the topic title if you use the Full Editor on the first post?

Thanks for the explanation...just wanted to make sure I wasn't missing or misunderstanding something.

 

Share this post


Link to post
Share on other sites
GreenCan

I believe you can change the topic title if you use the Full Editor on the first post?

Thanks for the explanation...just wanted to make sure I wasn't missing or misunderstanding something.

 

I changed the title and the zip file.  No change, just changed ADO in DSN, stupid me...

Thanks,


Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites
GreenCan

Why ?

because I felt sick yesterday, and still am this morning, hard to think straight...  :(


Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites
mLipok

I was seek (flu) 3 day ago.

So now I understand.


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-03-17

Share this post


Link to post
Share on other sites
robertocm

This is an example to access/query a MS Access table with a GUI using ADO

Adapted from: Phone Book Rev 02

Original Author: Ayman Henry

(Edited December 10, 2016):
Moved to avoid duplicate content

Edited by robertocm

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

    • dangr82
      By dangr82
       
      I have created this function for a database, but I can not make it work. I always have two error messages: "not an error" ... and the file created, in the script directory, does not contain anything.
      Global $sDBName = "Hen.db" Func DatabaseTable() Local $sConnDB _SQLite_Startup() If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite.dll Can't be Loaded!") Exit -1 EndIf $sConnDB = _SQLite_Open($sDBName) If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't Load Database!") Exit -1 EndIf If Not _SQLite_Exec($sDBName, 'CREATE TABLE Animal ("Name", "Age");') = $SQLITE_OK Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg()) If Not _SQLite_Exec($sDBName, 'INSERT INTO Animale VALUES ("Charlie","5");') = $SQLITE_OK Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg()) _SQLite_Close($sConnDB) _SQLite_Shutdown() EndFunc  
    • hugomito
      By hugomito
      Hi all,
      I hope you can help me with this. I need to connect to a Database using Cloudera ODBC Driver for Impala. I installed the driver, created a User DSN (drona2) and tested it successfully (got the message: Successfully connected to data source!) but when I try to connect to the database using a Conneciton String, it simply didn't work.
      I tried connecting to the database using the User DSN, I previously created, that has all parameters needed but got the following error:
           $ProviderDatasource = 'DSN=drona2;'
           $conn_Database = ObjCreate ("ADODB.Connection")
           $conn_Database.ConnectionString = $ProviderDatasource
           $conn_Database.Open
           ==> The requested action with this object has failed.:
           $conn_Database.Open
           $conn_Database.Open^ ERROR
      Also I tried adding all parameters to my connection string as follows but also got the same error:
           $ProviderDatasource = 'Driver=Cloudera ODBC Driver for Impala;Host=MyHost.domain.com;PORT=21050;AuthMech=3;UID=MyUserId@domain.com;PWD=MyPasswordc;Schema=default;SSL=1;AllowSelfSignedCerts=1;AllowHostNameCNMismatch=1;CheckCertRevocation=1;KrbFQDN=_HOTS;KrbServiceName=impala;ServicePrincipalCanonicalization=1'
      I hope someone has used this driver successfully before and can shed some light here.
      If you need additional information, let me know.
      Regards,
    • argumentum
      By argumentum
      ..let's say I store in a mysql column "[1,2,11,12,123]".
      How can I make s query to get all those rows that is 1, or is 12, etc ?
      I'm using  mysqlnd 5.0.11-dev - 20120503 
      Any advise on what technique I should use is welcomed
      Thanks
      PS: ..I'm adding a comma to each end, as in  [,1,2,11,12,123,] and will search with like %,12,% .
      Not pretty but I'm in a hurry and can't come up with a better solution =/
    • sc4ry
      By sc4ry
      Dear all,
      I already have a formula which will select doublicates, but sometimes there might be entries with additional information starting after "-", which I now want to trim away.
      Current formula is:
      Select DISTINCT a.title, a.oid, a.size, a.disk from DB a, DB b where (a.title like b.title and a.oid <> b.oid)" & $ActiveDisks_Filter & " AND (a.comment <> 'Delete' AND b.comment <> 'Delete') Order by a.title ASC, a.size DESC; testwise I want to add a simple solution like left, but afterwards I get an error but I do not know why.
      Select DISTINCT a.title, a.oid, a.size, a.disk from DB a, DB b where (left(a.title,15) like b.title and a.oid <> b.oid) Order by a.title ASC, a.size DESC; Error: near "(": syntax error: Finally I would like to insert intstr to search for "-" but currently I am not able to extend my current code =/
      Thanks a lot for your help.
      EDIT: hey, I managed it, left was not working also it was somehow shown that the tool knowed the comment. I did it now with substr+instr
      (substr(a.title, 1, instr(a.title, ' - '))  
    • AndyS19
      By AndyS19
      I have code that does a WMI SQL query to find all defined printers, and I want to parse the returned object in several places.  However, after parsing it the first time, all other times fail to find any printer objects.
      Here is my test code:
      test() Func test() Local $oPrinters, $oPrinter, $err, $cnt, $oP, $query $query = "SELECT * FROM Win32_Printer" $oPrinters = doQuery($query) $err = @error LogMsg("+++: $err = " & $err & ", isObj($oPrinters) = " & IsObj($oPrinters)) If ($err == 0) Then LogMsg("FIRST LOOP") ; <=== FIRST LOOP $cnt = 0 $oP = $oPrinters LogMsg("+++: isObj($oP) = " & IsObj($oP)) For $oPrinter In $oP $cnt += 1 LogMsg("+++: isObj($oPrinter): " & IsObj($oPrinter) & ", $oPrinter.Name ==>" & $oPrinter.Name & "<==") Next LogMsg("+++: Found " & $cnt & " printers") LogMsg("SECOND LOOP") ; <== SECOND LOOP $cnt = 0 $oP = $oPrinters LogMsg("+++: isObj($oP) = " & IsObj($oP)) For $oPrinter In $oP $cnt += 1 LogMsg("+++: isObj($oPrinter): " & IsObj($oPrinter) & ", $oPrinter.Name ==>" & $oPrinter.Name & "<==") Next LogMsg("+++: Found " & $cnt & " printers") EndIf EndFunc ;==>test Func doQuery($sQuery, $lnum = @ScriptLineNumber) #forceref $lnum LogMsg("+++:" & $lnum & ": doQuery(" & '"' & $sQuery & '"' & ") entered") Local $oWMIService, $oResults, $errstr Local $wbemFlags = BitOR(0x20, 0x10) ; $wbemFlagReturnImmediately and wbemFlagForwardOnly $oWMIService = ObjGet("winmgmts:\\" & "localhost" & "\root\CIMV2") If (IsObj($oWMIService)) Then $oResults = $oWMIService.ExecQuery($sQuery, "WQL", $wbemFlags) If (IsObj($oResults)) Then LogMsg("+++: doQuery() returns @error = 0, Good: returning the object") Return (SetError(0, 0, $oResults)) ;;; Good: return the object Else $errstr = "" _ & "WMI Query failed." & @CRLF _ & "This is the query:" & @CRLF _ & " " & $sQuery LogMsg("+++: ====>" & $errstr & "<===") LogMsg("+++: doQuery() returns @error = 1") Return (SetError(1, 0, $errstr)) ; Error: Query faled EndIf Else $errstr = "" _ & "WMI Output" & @CRLF _ & "No WMI Objects Found for class: " & @CRLF _ & "Win32_PrinterDriver" & @CRLF _ & "using this query:" & @CRLF _ & " " & $sQuery LogMsg("+++: ====>" & $errstr & "<===") MsgBox(0, "ERROR", $errstr) ; Error: Cannot get $oWMIService object Exit (1) EndIf EndFunc ;==>doQuery Func LogMsg($msg, $lnum = @ScriptLineNumber) ConsoleWrite("+++:" & $lnum & ": " & $msg & @CRLF) EndFunc ;==>LogMsg Parsing the returned $oPrinters object shows 5 printers:
      +++:15: FIRST LOOP +++:18: +++: isObj($oP) = 1 +++:22: +++: isObj($oPrinter): 1, $oPrinter.Name ==>Microsoft XPS Document Writer<== +++:22: +++: isObj($oPrinter): 1, $oPrinter.Name ==>Microsoft Office Document Image Writer<== +++:22: +++: isObj($oPrinter): 1, $oPrinter.Name ==>Fax<== +++:22: +++: isObj($oPrinter): 1, $oPrinter.Name ==>Canon MG7100 series Printer WS<== +++:22: +++: isObj($oPrinter): 1, $oPrinter.Name ==>Canon MG6100 series Printer WS<== +++:24: +++: Found 5 printers Parsing it again, shows no printers:
      +++:26: SECOND LOOP +++:29: +++: isObj($oP) = 1 +++:35: +++: Found 0 printers  
×