Jump to content

ADO.au3 UDF - BETA - Support Topic


mLipok
 Share

Recommended Posts

14 minutes ago, Stuzz said:

I have a script that includes ADO.au3 which I created near the end of last year.  I also have a compiled .exe version of it.  I'm attempting to modify the script now, but when I try to build it (via F7 in Scite) I receive the following error:

---------------------------
Aut2Exe Error
---------------------------
Line 2393  (File "C:\Program Files (x86)\AutoIt3\Include\ADO.au3"):

Local $sParam = ($bOnlyYMD = True) ? '$1\/$2\/$3' : '$1\/$2\/$3\ $4:$5:$6'
Local $sParam = ($bOnlyYMD = True) ^ ERROR

Error: Unable to parse line.
---------------------------
OK   
---------------------------

Hopefully a simple error on my part, but I'm not sure where to start in order to fix it.

Thanks

Edit:  All the above can safely be ignored.  I'm not sure how, but I had an older version of AutoIt installed.  I just downloaded and installed the current versions of it and Scite, and the script built without issue.
 

 

Link to comment
Share on other sites

You seem to be using a pretty old version of AutoIt, since the ternary operator was introduced quite a long time ago: 3.3.10.0 (23rd December, 2013) (Release)

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

  • 3 months later...

hi  i  have  alittle problem , but i dont kwnow if is bound at ado

i use ADO for connect db mysql , work great  speacila thankz  again  Mlipok , i  have creted somthing like this

Local $aLDataTable = _MySQL_Query("show tables")
    $Combo1 = GUICtrlCreateCombo("Instrumets", 104, 0, 145, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
    For $i = 0 To UBound($aLDataTable) - 1
        MsgBox(0,$i,$aLDataTable[$i])
        GUICtrlSetData($Combo1, $aLDataTable[$i])

    Next

the function _Mysql_Query is

Func _MySQL_Query($sQUERY)

    Local $sLConnect =_MysqlJoin()

; Create connection object
    Local $oConnection = _ADO_Connection_Create()

    ; Open connection with $sConnectionString
    _ADO_Connection_OpenConString($oConnection, $sLConnect)
    If @error Then Return SetError(@error, @extended, $ADO_RET_FAILURE)

    ; Executing some query
    Local $oRecordset = _ADO_Execute($oConnection, $sQUERY)

    ; Get recordset to array of arrays (Conent and ColumnNames)
    Local $aRecordsetAsArray = _ADO_Recordset_ToArray($oRecordset, False)

    ; Get inner array - only conent of Recordset
    Local $aRecordsetContent = _ADO_RecordsetArray_GetContent($aRecordsetAsArray)

    Return $aRecordsetContent


    ; Clean Up
    $oRecordset = Null
    _ADO_Connection_Close($oConnection)
    $oConnection = Null

EndFunc

the  function mysqljoin is

Func _MysqlJoin()

    If $sDriver = "nessuno" And $iDebug = 1 Then
        MsgBox(48, "Error 1", "Errore nella lettura del file Config.ini")
    ElseIf $iDebug = 1 Then
        Local $sConnectionString = _ADO_ConnectionString_MySQL($sUser, $sPassword, $sDatabase, $sDriver, $sServer, $sPort)
        _Example_3_ConnectionProperties($sConnectionString)
    ElseIf $iDebug =0 Then
        Local $sConnectionString = _ADO_ConnectionString_MySQL($sUser, $sPassword, $sDatabase, $sDriver, $sServer, $sPort)
        Return $sConnectionString
    EndIf

EndFunc   ;==>_MysqlJoin

the  strange thinghs  is if  after this  code  Local $aLDataTable = _MySQL_Query("show tables") ,  insert _arraydisplay ( $aLDataTable) retrun me the array  but when continue  the  and go in for  crashed with this error .

"C:\Users\pc\Desktop\timeandsale\TickerTapeMachine.au3" (49) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
MsgBox(0,$i,$aLDataTable[$i])
MsgBox(0,$i,^ ERROR
->22:18:49 AutoIt3.exe ended.rc:1

but  for  is correct o_O

Edited by faustf
Link to comment
Share on other sites

GUICtrlSetData($Combo1, $aLDataTable[$i])

this table has two dimensions, not one.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Link to comment
Share on other sites

Hi mLipok. Many thanks for your library! I'm trying to make it work with an Access Database (c:\Temp\Computers2.accdb)

I've downloaded "Microsoft Access Database Engine 2016 Redistributable" from here: https://www.microsoft.com/en-us/download/details.aspx?id=54920  ("AccessDatabaseEngine.exe") 32 bit version. I can confirm, that now I have "MS Access Database", Platform: "32-bit", Driver: "Microsoft Access Driver (*.mdb, *.accdb)" under "User DSN" tab inside "ODBC Data Source Administrator (32 bit)" located in Control Panel.

I've made the following changes to "ADO_EXAMPLE.au3"

Func _Example_MSAccess()

    Local $sMDB_FileFullPath = "C:\Temp\Computers2.accdb" ;'Here put FileFullPath to your Access File'
    Local $sDriver = "Microsoft Access Driver (*.mdb, *.accdb)"
    Local $sUser = Default
    Local $sPassword = Default

    Local $sConnectionString = _ADO_ConnectionString_Access($sMDB_FileFullPath, $sUser, $sPassword, $sDriver)

    _Example_1_RecordsetToConsole($sConnectionString, "Select * from tblComputers")
    _Example_2_RecordsetDisplay($sConnectionString, "Select * from tblComputers")
    _Example_3_ConnectionProperties($sConnectionString)

EndFunc   ;==>_Example_MSAccess

I get the following errors:

###############################
ADO.au3 v.2.1.16 BETA (1150) : ==> COM Error intercepted !
$oADO_Error.description is:     [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
$oADO_Error.windescription:     Exception occurred.

$oADO_Error.number is:  80020009
$oADO_Error.lastdllerror is:    0
$oADO_Error.scriptline is:  1150
$oADO_Error.source is:  Microsoft OLE DB Provider for ODBC Drivers
$oADO_Error.helpfile is:    
$oADO_Error.helpcontext is:     0
###############################
###############################
ADO.au3 v.2.1.16 BETA (1150) : ==> COM Error intercepted !
$oADO_Error.description is:     [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
$oADO_Error.windescription:     Exception occurred.

$oADO_Error.number is:  80020009
$oADO_Error.lastdllerror is:    0
$oADO_Error.scriptline is:  1150
$oADO_Error.source is:  Microsoft OLE DB Provider for ODBC Drivers
$oADO_Error.helpfile is:    
$oADO_Error.helpcontext is:     0
###############################
###############################
ADO.au3 v.2.1.16 BETA (1150) : ==> COM Error intercepted !
$oADO_Error.description is:     [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
$oADO_Error.windescription:     Exception occurred.

$oADO_Error.number is:  80020009
$oADO_Error.lastdllerror is:    0
$oADO_Error.scriptline is:  1150
$oADO_Error.source is:  Microsoft OLE DB Provider for ODBC Drivers
$oADO_Error.helpfile is:    
$oADO_Error.helpcontext is:     0
###############################
+>08:29:39 AutoIt3.exe ended.rc:0
+>08:29:39 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 2.511

 

 

Can you please help? Many thanks!

 

Machine-related information: 

Windows 10 64 bit Enterprise

MS office 465 ProPlus - en-us  version 16.0.11929.20838

AutoIT v.3.3.14.5

 

 

 

Link to comment
Share on other sites

Quote

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

You must install driver.

Try this or this.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Link to comment
Share on other sites

You need to download a driver AND install it:

C:\Windows\SysWOW64\odbcad32.exe

 

Then, the EXACT name it displays inside the ODBC dialog needs to be used in the script.

To ensure uniformity across installation, consider bundling the driver with the script.

:)

 

 

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

14 hours ago, mLipok said:

You must install driver.

Try this or this.

 

Thank you mLipok. Sorry, I forgot to mention that after downloading I did install it. Please find attached screenshots. Does it have to be 32 bit version or 64 bit version? I've tried both one-by-one, but still no luck. Does it depend on Windows (I have 64 bit)/Office (32 bit)/AutoIt (@AutoItX64 returns non-one, so I think I run 32 bit version of the script)?

User DSN.jpg

Drivers_Tab.jpg

 

I've turned on Tracing (see attached screenshot)

And got the following inside "SQL.LOG":

 

ADO_EXAMPLE     9fc-2d1c    ENTER SQLAllocEnv 
        HENV *              0x7956F2B8

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLAllocEnv  with return code 0 (SQL_SUCCESS)
        HENV *              0x7956F2B8 ( 0x009AB858)

ADO_EXAMPLE     9fc-2d1c    ENTER SQLGetEnvAttr 
        SQLHENV             0x009AB858
        SQLINTEGER                 201 <SQL_ATTR_CONNECTION_POOLING>
        SQLPOINTER          0x007DD244
        SQLINTEGER                   4 
        SQLINTEGER *        0x007DD240

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLGetEnvAttr  with return code 0 (SQL_SUCCESS)
        SQLHENV             0x009AB858
        SQLINTEGER                 201 <SQL_ATTR_CONNECTION_POOLING>
        SQLPOINTER          0x007DD244 (0) <SQL_CP_OFF>
        SQLINTEGER                   4 
        SQLINTEGER *        0x007DD240 (156250)

ADO_EXAMPLE     9fc-2d1c    ENTER SQLAllocEnv 
        HENV *              0x7956F2BC

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLAllocEnv  with return code 0 (SQL_SUCCESS)
        HENV *              0x7956F2BC ( 0x009AB8D8)

ADO_EXAMPLE     9fc-2d1c    ENTER SQLSetEnvAttr 
        SQLHENV             0x009AB8D8
        SQLINTEGER                 201 <SQL_ATTR_CONNECTION_POOLING>
        SQLPOINTER                 0 <SQL_CP_OFF>
        SQLINTEGER                  -6 

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLSetEnvAttr  with return code 0 (SQL_SUCCESS)
        SQLHENV             0x009AB8D8
        SQLINTEGER                 201 <SQL_ATTR_CONNECTION_POOLING>
        SQLPOINTER                 0 <SQL_CP_OFF>
        SQLINTEGER                  -6 

ADO_EXAMPLE     9fc-2d1c    ENTER SQLAllocConnect 
        HENV                0x009AB8D8
        HDBC *              0x007DD6B8

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLAllocConnect  with return code 0 (SQL_SUCCESS)
        HENV                0x009AB8D8
        HDBC *              0x007DD6B8 ( 0x009AD960)

ADO_EXAMPLE     9fc-2d1c    ENTER SQLGetInfoW 
        HDBC                0x009AD960
        UWORD                       10 <SQL_ODBC_VER>
        PTR                 0x007DE2D4 
        SWORD                       22 
        SWORD *             0x00000000

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLGetInfoW  with return code 0 (SQL_SUCCESS)
        HDBC                0x009AD960
        UWORD                       10 <SQL_ODBC_VER>
        PTR                 0x007DE2D4 [      -3] "03.80.0000\ 0"
        SWORD                       22 
        SWORD *             0x00000000

ADO_EXAMPLE     9fc-2d1c    ENTER SQLSetConnectAttrW 
        SQLHDBC             0x009AD960
        SQLINTEGER                 103 <SQL_ATTR_LOGIN_TIMEOUT>
        SQLPOINTER                15
        SQLINTEGER                  -6 

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLSetConnectAttrW  with return code 0 (SQL_SUCCESS)
        SQLHDBC             0x009AD960
        SQLINTEGER                 103 <SQL_ATTR_LOGIN_TIMEOUT>
        SQLPOINTER                15
        SQLINTEGER                  -6 

ADO_EXAMPLE     9fc-2d1c    ENTER SQLDriverConnectW 
        HDBC                0x009AD960
        HWND                0x00000000
        WCHAR *             0x79592430 [      -3] "******\ 0"
        SWORD                       -3 
        WCHAR *             0x79592430 
        SWORD                       -3 
        SWORD *             0x00000000
        UWORD                        0 <SQL_DRIVER_NOPROMPT>

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLDriverConnectW  with return code -1 (SQL_ERROR)
        HDBC                0x009AD960
        HWND                0x00000000
        WCHAR *             0x79592430 [      -3] "******\ 0"
        SWORD                       -3 
        WCHAR *             0x79592430 
        SWORD                       -3 
        SWORD *             0x00000000
        UWORD                        0 <SQL_DRIVER_NOPROMPT>

        DIAG [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) 

ADO_EXAMPLE     9fc-2d1c    ENTER SQLGetDiagRecW 
        SQLSMALLINT                  2 <SQL_HANDLE_DBC>
        SQLHANDLE           0x009AD960
        SQLSMALLINT                  1 
        SQLWCHAR *          0x007DE234
        SQLINTEGER *        0x007DDE10
        SQLWCHAR *          0x007DDE34 
        SQLSMALLINT                512 
        SQLSMALLINT *       0x007DDE30

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLGetDiagRecW  with return code 0 (SQL_SUCCESS)
        SQLSMALLINT                  2 <SQL_HANDLE_DBC>
        SQLHANDLE           0x009AD960
        SQLSMALLINT                  1 
        SQLWCHAR *          0x007DE234 [       5] "IM002"
        SQLINTEGER *        0x007DDE10 (0)
        SQLWCHAR *          0x007DDE34 [      91] "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
        SQLSMALLINT                512 
        SQLSMALLINT *       0x007DDE30 (91)

ADO_EXAMPLE     9fc-2d1c    ENTER SQLGetDiagRecW 
        SQLSMALLINT                  2 <SQL_HANDLE_DBC>
        SQLHANDLE           0x009AD960
        SQLSMALLINT                  2 
        SQLWCHAR *          0x007DE234
        SQLINTEGER *        0x007DDE10
        SQLWCHAR *          0x007DDE34 
        SQLSMALLINT                512 
        SQLSMALLINT *       0x007DDE30

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLGetDiagRecW  with return code 100 (SQL_NO_DATA_FOUND)
        SQLSMALLINT                  2 <SQL_HANDLE_DBC>
        SQLHANDLE           0x009AD960
        SQLSMALLINT                  2 
        SQLWCHAR *          0x007DE234
        SQLINTEGER *        0x007DDE10
        SQLWCHAR *          0x007DDE34 
        SQLSMALLINT                512 
        SQLSMALLINT *       0x007DDE30

ADO_EXAMPLE     9fc-2d1c    ENTER SQLFreeConnect 
        HDBC                0x009AD960

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLFreeConnect  with return code 0 (SQL_SUCCESS)
        HDBC                0x009AD960

ADO_EXAMPLE     9fc-2d1c    ENTER SQLAllocConnect 
        HENV                0x009AB8D8
        HDBC *              0x007DD6B8

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLAllocConnect  with return code 0 (SQL_SUCCESS)
        HENV                0x009AB8D8
        HDBC *              0x007DD6B8 ( 0x009AD960)

ADO_EXAMPLE     9fc-2d1c    ENTER SQLSetConnectAttrW 
        SQLHDBC             0x009AD960
        SQLINTEGER                 103 <SQL_ATTR_LOGIN_TIMEOUT>
        SQLPOINTER                15
        SQLINTEGER                  -6 

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLSetConnectAttrW  with return code 0 (SQL_SUCCESS)
        SQLHDBC             0x009AD960
        SQLINTEGER                 103 <SQL_ATTR_LOGIN_TIMEOUT>
        SQLPOINTER                15
        SQLINTEGER                  -6 

ADO_EXAMPLE     9fc-2d1c    ENTER SQLDriverConnectW 
        HDBC                0x009AD960
        HWND                0x00000000
        WCHAR *             0x79592430 [      -3] "******\ 0"
        SWORD                       -3 
        WCHAR *             0x79592430 
        SWORD                       -3 
        SWORD *             0x00000000
        UWORD                        0 <SQL_DRIVER_NOPROMPT>

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLDriverConnectW  with return code -1 (SQL_ERROR)
        HDBC                0x009AD960
        HWND                0x00000000
        WCHAR *             0x79592430 [      -3] "******\ 0"
        SWORD                       -3 
        WCHAR *             0x79592430 
        SWORD                       -3 
        SWORD *             0x00000000
        UWORD                        0 <SQL_DRIVER_NOPROMPT>

        DIAG [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) 

ADO_EXAMPLE     9fc-2d1c    ENTER SQLGetDiagRecW 
        SQLSMALLINT                  2 <SQL_HANDLE_DBC>
        SQLHANDLE           0x009AD960
        SQLSMALLINT                  1 
        SQLWCHAR *          0x007DE234
        SQLINTEGER *        0x007DDE10
        SQLWCHAR *          0x007DDE34 
        SQLSMALLINT                512 
        SQLSMALLINT *       0x007DDE30

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLGetDiagRecW  with return code 0 (SQL_SUCCESS)
        SQLSMALLINT                  2 <SQL_HANDLE_DBC>
        SQLHANDLE           0x009AD960
        SQLSMALLINT                  1 
        SQLWCHAR *          0x007DE234 [       5] "IM002"
        SQLINTEGER *        0x007DDE10 (0)
        SQLWCHAR *          0x007DDE34 [      91] "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
        SQLSMALLINT                512 
        SQLSMALLINT *       0x007DDE30 (91)

ADO_EXAMPLE     9fc-2d1c    ENTER SQLGetDiagRecW 
        SQLSMALLINT                  2 <SQL_HANDLE_DBC>
        SQLHANDLE           0x009AD960
        SQLSMALLINT                  2 
        SQLWCHAR *          0x007DE234
        SQLINTEGER *        0x007DDE10
        SQLWCHAR *          0x007DDE34 
        SQLSMALLINT                512 
        SQLSMALLINT *       0x007DDE30

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLGetDiagRecW  with return code 100 (SQL_NO_DATA_FOUND)
        SQLSMALLINT                  2 <SQL_HANDLE_DBC>
        SQLHANDLE           0x009AD960
        SQLSMALLINT                  2 
        SQLWCHAR *          0x007DE234
        SQLINTEGER *        0x007DDE10
        SQLWCHAR *          0x007DDE34 
        SQLSMALLINT                512 
        SQLSMALLINT *       0x007DDE30

ADO_EXAMPLE     9fc-2d1c    ENTER SQLFreeConnect 
        HDBC                0x009AD960

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLFreeConnect  with return code 0 (SQL_SUCCESS)
        HDBC                0x009AD960

ADO_EXAMPLE     9fc-2d1c    ENTER SQLAllocConnect 
        HENV                0x009AB8D8
        HDBC *              0x007DD6B8

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLAllocConnect  with return code 0 (SQL_SUCCESS)
        HENV                0x009AB8D8
        HDBC *              0x007DD6B8 ( 0x009AD960)

ADO_EXAMPLE     9fc-2d1c    ENTER SQLSetConnectAttrW 
        SQLHDBC             0x009AD960
        SQLINTEGER                 103 <SQL_ATTR_LOGIN_TIMEOUT>
        SQLPOINTER                15
        SQLINTEGER                  -6 

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLSetConnectAttrW  with return code 0 (SQL_SUCCESS)
        SQLHDBC             0x009AD960
        SQLINTEGER                 103 <SQL_ATTR_LOGIN_TIMEOUT>
        SQLPOINTER                15
        SQLINTEGER                  -6 

ADO_EXAMPLE     9fc-2d1c    ENTER SQLDriverConnectW 
        HDBC                0x009AD960
        HWND                0x00000000
        WCHAR *             0x79592430 [      -3] "******\ 0"
        SWORD                       -3 
        WCHAR *             0x79592430 
        SWORD                       -3 
        SWORD *             0x00000000
        UWORD                        0 <SQL_DRIVER_NOPROMPT>

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLDriverConnectW  with return code -1 (SQL_ERROR)
        HDBC                0x009AD960
        HWND                0x00000000
        WCHAR *             0x79592430 [      -3] "******\ 0"
        SWORD                       -3 
        WCHAR *             0x79592430 
        SWORD                       -3 
        SWORD *             0x00000000
        UWORD                        0 <SQL_DRIVER_NOPROMPT>

        DIAG [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) 

ADO_EXAMPLE     9fc-2d1c    ENTER SQLGetDiagRecW 
        SQLSMALLINT                  2 <SQL_HANDLE_DBC>
        SQLHANDLE           0x009AD960
        SQLSMALLINT                  1 
        SQLWCHAR *          0x007DE234
        SQLINTEGER *        0x007DDE10
        SQLWCHAR *          0x007DDE34 
        SQLSMALLINT                512 
        SQLSMALLINT *       0x007DDE30

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLGetDiagRecW  with return code 0 (SQL_SUCCESS)
        SQLSMALLINT                  2 <SQL_HANDLE_DBC>
        SQLHANDLE           0x009AD960
        SQLSMALLINT                  1 
        SQLWCHAR *          0x007DE234 [       5] "IM002"
        SQLINTEGER *        0x007DDE10 (0)
        SQLWCHAR *          0x007DDE34 [      91] "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
        SQLSMALLINT                512 
        SQLSMALLINT *       0x007DDE30 (91)

ADO_EXAMPLE     9fc-2d1c    ENTER SQLGetDiagRecW 
        SQLSMALLINT                  2 <SQL_HANDLE_DBC>
        SQLHANDLE           0x009AD960
        SQLSMALLINT                  2 
        SQLWCHAR *          0x007DE234
        SQLINTEGER *        0x007DDE10
        SQLWCHAR *          0x007DDE34 
        SQLSMALLINT                512 
        SQLSMALLINT *       0x007DDE30

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLGetDiagRecW  with return code 100 (SQL_NO_DATA_FOUND)
        SQLSMALLINT                  2 <SQL_HANDLE_DBC>
        SQLHANDLE           0x009AD960
        SQLSMALLINT                  2 
        SQLWCHAR *          0x007DE234
        SQLINTEGER *        0x007DDE10
        SQLWCHAR *          0x007DDE34 
        SQLSMALLINT                512 
        SQLSMALLINT *       0x007DDE30

ADO_EXAMPLE     9fc-2d1c    ENTER SQLFreeConnect 
        HDBC                0x009AD960

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLFreeConnect  with return code 0 (SQL_SUCCESS)
        HDBC                0x009AD960

ADO_EXAMPLE     9fc-2d1c    ENTER SQLFreeEnv 
        HENV                0x009AB858

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLFreeEnv  with return code 0 (SQL_SUCCESS)
        HENV                0x009AB858

ADO_EXAMPLE     9fc-2d1c    ENTER SQLFreeEnv 
        HENV                0x009AB8D8

ADO_EXAMPLE     9fc-2d1c    EXIT  SQLFreeEnv  with return code 0 (SQL_SUCCESS)
        HENV                0x009AB8D8

 

Tracing.jpg

Edited by AlexMethuselah
update
Link to comment
Share on other sites

try to use:

#AutoIt3Wrapper_UseX64=N

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Link to comment
Share on other sites

  • 2 months later...

Hello mLipok
I want to ask what does this error means? 
 

ADO.au3 v.2.1.16 BETA (1150) : ==> COM Error intercepted !
$oADO_Error.description is:     Provider cannot be found. It may not be properly installed.
$oADO_Error.windescription:     Exception occurred.

$oADO_Error.number is:     80020009
$oADO_Error.lastdllerror is:     0
$oADO_Error.scriptline is:     1150
$oADO_Error.source is:     ADODB.Connection
$oADO_Error.helpfile is:     C:\Windows\HELP\ADO270.CHM
$oADO_Error.helpcontext is:     1240655
###############################

i already install msoledbsql 17 x64 and msodbcsql 17 x64 too but the error still said provider cannot be found.
i really need your help, thankyou very much mLipok

Link to comment
Share on other sites

please check 

_ADO_GetProvidersList()

and give here results.

EDIT:
check also:

_ADO_GetDSNList()

and show how you create connection string (of course anonymize LOGIN/USER and PASSWD )

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Link to comment
Share on other sites

Providers.PNG.6cd834db0358505d13885357c0730c64.PNG

Func _Example_MSSQL_SQLServerAuthorization($sQuery)
    Local $sDriver = "SQL Server"
    Local $sDatabase = "Database" ; change this string to YourDatabaseName
    Local $sServer = "10.64.xx.xx" ; change this string to YourServerLocation
    Local $sUser = "****" ; change this string to YourUserName
    Local $sPassword = "****" ; change this string to YourPassword
    Local $sConnectionString = 'DRIVER={' & $sDriver & '};SERVER=' & $sServer & ';DATABASE=' & $sDatabase & ';UID=' & $sUser & ';PWD=' & $sPassword & ';'

i got no result from the _ADO_GetDSNList() function

Link to comment
Share on other sites

Are you using x32 or x64 AutoIt? 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Link to comment
Share on other sites

8 hours ago, mLipok said:

Are you using x32 or x64 AutoIt? 

just add this to top of your "main" script:

#AutoIt3Wrapper_UseX64=n ; In order for the x86 DLLs to work
ConsoleWrite("! @AutoItX64 = " & @AutoItX64 & @CRLF)

and show what you have in console.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Link to comment
Share on other sites

Please run: odbcad32.exe

ODBC Data Sources (32-Bit)

do you have this follwing window ?
Show yours screenshot.
 

image.png.86c75bcbc5f1c9323b0282dd0e045244.png

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Link to comment
Share on other sites

I just create/modify Article on AutoIt WIKI

https://www.autoitscript.com/wiki/ADO_Event_handling#First_example

lobal $__g_oConnection = ObjCreate("ADODB.Connection")
Global $__g_oErrorHandler = ObjEvent("AutoIt.Error", _ErrFunc)
Global $__g_oADO_EventHandler = ObjEvent($__g_oConnection, "__ADO_EVENT__")

_Example()
Func _Example()
    Local $sPassword = 'AutoIt' ; change to your own pass
    Local $sInstance = 'localhost\SQLExpress' ; change to your own SQL server Instances
    $__g_oConnection.Open("PROVIDER=SQLOLEDB.1;SERVER=" & $sInstance & ";uid=sa;pwd=" & $sPassword & ";")
    Local $objquery = $__g_oConnection.Execute("print 'this is a test - hello - Line 1'")
    $objquery.parent2

    $__g_oConnection.Execute("UPDATE [BAZA].[dbo].[Adresy] SET [Numer] = 1 WHERE [Numer] = 1")
    $__g_oConnection.Execute("UPDATE [BAZA].[dbo].[Adresy] SET [Numer] = [numer]")
    #forceref $objquery

EndFunc   ;==>_Example

Func _ErrFunc(ByRef $oError)
    ConsoleWrite(@CRLF & _
            "! ==> COM Error intercepted ==>" & @CRLF & _
            "-" & @TAB & "$oError.description is: " & @TAB & $oError.description & @CRLF & _
            "-" & @TAB & "$oError.number is: " & @TAB & @TAB & $oError.number & "   in HEX is  0x" & Hex($oError.number) & @CRLF & _
            "-" & @TAB & "$oError.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            "-" & @TAB & "$oError.windescription:" & @TAB & @TAB & $oError.windescription & @CRLF & _
            "-" & @TAB & "$oError.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            "-" & @TAB & "$oError.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            "-" & @TAB & "$oError.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            "-" & @TAB & "$oError.scriptline is: " & @TAB & @TAB & $oError.scriptline & @CRLF & _
            "-" & @TAB & "$oError.retcode is: " & @TAB & @TAB & "0x" & Hex($oError.retcode) & @CRLF & _
            "! ==> COM End of Error dump." & @CRLF & _
            @CRLF)
EndFunc   ;==>_ErrFunc

Func __ADO_ConsoleWrite_Blue($sText)
    ConsoleWrite('>>' & $sText & @CRLF)
EndFunc   ;==>__ADO_ConsoleWrite_Blue

; ####################################

Func __ADO_EVENT__WillConnect($sConnection_String, $sUserID, $sPassword, $iOptions, $i_adStatus, ByRef $oConnection)
;~  Return
    __ADO_ConsoleWrite_Blue(@CRLF)
    __ADO_ConsoleWrite_Blue("__ADO_EVENT__WillConnect:")
;~  __ADO_ConsoleWrite_Blue("   $sConnection_String=" & $sConnection_String) ; for security reason should not be populated to output
    __ADO_ConsoleWrite_Blue("   $sConnection_String=" & StringLen($sConnection_String)) ; for security reason should not be populated to output
    __ADO_ConsoleWrite_Blue("   $sUserID=" & $sUserID)
    __ADO_ConsoleWrite_Blue("   $sPassword=" & $sPassword)
    __ADO_ConsoleWrite_Blue("   $iOptions=" & $iOptions)
    __ADO_ConsoleWrite_Blue("   $i_adStatus=" & $i_adStatus)
    #forceref $oConnection
EndFunc   ;==>__ADO_EVENT__WillConnect

Func __ADO_EVENT__ConnectComplete(ByRef $oError, $i_adStatus, ByRef $oConnection)
    #forceref $oError, $oConnection
    __ADO_ConsoleWrite_Blue(@CRLF)
    __ADO_ConsoleWrite_Blue("__ADO_EVENT__ConnectComplete:")
    __ADO_ConsoleWrite_Blue("   $i_adStatus=" & $i_adStatus)
EndFunc   ;==>__ADO_EVENT__ConnectComplete

Func __ADO_EVENT__InfoMessage(ByRef $oError, $i_adStatus, ByRef $oConnection)
    #forceref $oError, $oConnection
    __ADO_ConsoleWrite_Blue(@CRLF)
    __ADO_ConsoleWrite_Blue("__ADO_EVENT__InfoMessage:")
    __ADO_ConsoleWrite_Blue("   $i_adStatus=" & $i_adStatus)
EndFunc   ;==>__ADO_EVENT__InfoMessage

Func __ADO_EVENT__ExecuteComplete($iRecordsAffected, $oError, $i_adStatus, ByRef $oCommand, ByRef $oRecordset, ByRef $oConnection)
    #forceref $oCommand, $oRecordset
    __ADO_ConsoleWrite_Blue(@CRLF)
    __ADO_ConsoleWrite_Blue("__ADO_EVENT__ExecuteComplete:")
    __ADO_ConsoleWrite_Blue("   $iRecordsAffected=" & $iRecordsAffected)
    __ADO_ConsoleWrite_Blue("   VarGetType($oError)=" & VarGetType($oError))
    __ADO_ConsoleWrite_Blue("   $i_adStatus=" & $i_adStatus)
    Local $iErrorCol_Max = $oConnection.errors.Count
    If $iErrorCol_Max = 0 Then Return
    Local $oErr
    For $iErrorCol_idx = 0 To $iErrorCol_Max - 1
        If $iErrorCol_idx = 0 Then __ADO_ConsoleWrite_Blue("> ==> ADO Error Collection: .errors.Count = " & $iErrorCol_Max)
        $oErr = $oConnection.errors.Item($iErrorCol_idx)
        If Not ($oErr.NativeError Or $oErr.number) Then
            __ADO_ConsoleWrite_Blue(@TAB & "$oErr.Item(" & $iErrorCol_idx & ").description is: " & @TAB & @TAB & $oErr.description)
            __ADO_ConsoleWrite_Blue(@TAB & "$oErr.Item(" & $iErrorCol_idx & ").source is: " & @TAB & @TAB & $oErr.source)
            __ADO_ConsoleWrite_Blue(@TAB & "$oErr.Item(" & $iErrorCol_idx & ").SQLState is: " & @TAB & @TAB & $oErr.SQLState)
            __ADO_ConsoleWrite_Blue(@TAB & "$oErr.Item(" & $iErrorCol_idx & ").NativeError is: " & @TAB & @TAB & $oErr.NativeError)
        Else
            __ADO_ConsoleWrite_Blue(@TAB & "$oErr.Item(" & $iErrorCol_idx & ").description is: " & @TAB & @TAB & $oErr.description)
            __ADO_ConsoleWrite_Blue(@TAB & "$oErr.Item(" & $iErrorCol_idx & ").source is: " & @TAB & @TAB & $oErr.source)
            __ADO_ConsoleWrite_Blue(@TAB & "$oErr.Item(" & $iErrorCol_idx & ").NativeError is: " & @TAB & @TAB & $oErr.NativeError)
            __ADO_ConsoleWrite_Blue(@TAB & "$oErr.Item(" & $iErrorCol_idx & ").SQLState is: " & @TAB & @TAB & $oErr.SQLState)
            __ADO_ConsoleWrite_Blue(@TAB & "$oErr.Item(" & $iErrorCol_idx & ").windescription:" & @TAB & @TAB & $oErr.windescription)
;~          __ADO_ConsoleWrite_Blue(@TAB & "$oErr.Item(" & $iErrorCol_idx & ").scriptline is: " & @TAB & @TAB & $oErr.scriptline )
            __ADO_ConsoleWrite_Blue(@TAB & "$oErr.Item(" & $iErrorCol_idx & ").helpfile is: " & @TAB & @TAB & $oErr.helpfile)
            __ADO_ConsoleWrite_Blue(@TAB & "$oErr.Item(" & $iErrorCol_idx & ").helpcontext is: " & @TAB & $oErr.helpcontext)
            __ADO_ConsoleWrite_Blue(@TAB & "$oErr.Item(" & $iErrorCol_idx & ").lastdllerror is: " & @TAB & $oErr.lastdllerror)
            __ADO_ConsoleWrite_Blue(@TAB & "$oErr.Item(" & $iErrorCol_idx & ").number is: " & @TAB & @TAB & "0x" & Hex($oErr.number))
            __ADO_ConsoleWrite_Blue(@TAB & "$oErr.Item(" & $iErrorCol_idx & ").retcode is: " & @TAB & @TAB & "0x" & Hex($oErr.retcode))
        EndIf
    Next
;~  $oConnection.errors.clear
EndFunc   ;==>__ADO_EVENT__ExecuteComplete

 

This example shows:

  1. How to use ADO Events in AutoIt 
  2. How to catch up "Print Messages"
  3. How to get number of affected records, changed by "UPDATE" or "DELETE" clausule.

 

Have a nice reading/analizying.
Best regards,

mLipok

 

EDIT:
As for now this example was not used ADO.au3 UDF.
This example is a modest introduction to introducing these functionalities to ADO.au3 UDF.

 

EDIT 2:
Thanks to @buymeapc for inspiration to work on this.

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Link to comment
Share on other sites

  • 2 weeks later...

Hello,
I am using ADO to connect to MS SQL. Windows Authentication works fine. What to do to connect to SQL using domain authentication for a user other than logged in? When I try to use ADO with SQL server authentication, but I provide login and domain password, I get the error:

[Microsoft] [ODBC SQL Server Driver] [SQL Server] Login failed for user 'domain \ sqluser'


From the  SQL Server side, I can see in the Windows logs:
 

Login failed for user 'domain \ sqluser'. Reason: Attempting to use an NT account name with SQL Server Authentication.

 

Link to comment
Share on other sites

To analyze what is going wrong you should show how you construct your connection string in AutoIt using ADO.au3

REMARK: Of course DO NOT FORGET annonymize login and password and eventually host if is not on local IP.

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Link to comment
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
 Share

×
×
  • Create New...