Jump to content
mLipok

ADO.au3 UDF - BETA - Support Topic

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.
 

 

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites
Posted (edited)

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

Share this post


Link to post
Share on other sites
GUICtrlSetData($Combo1, $aLDataTable[$i])

this table has two dimensions, not one.


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
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 APIErrorLog.au3 UDF - A logging Library *

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 * 

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 TaskScheduler

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: 2019-10-01

Share this post


Link to post
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

 

 

 

Share this post


Link to post
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:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
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 APIErrorLog.au3 UDF - A logging Library *

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 * 

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 TaskScheduler

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: 2019-10-01

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites
Posted (edited)
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

Share this post


Link to post
Share on other sites

try to use:

#AutoIt3Wrapper_UseX64=N

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
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 APIErrorLog.au3 UDF - A logging Library *

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 * 

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 TaskScheduler

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: 2019-10-01

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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Nas
      Hi everyone,
      I am trying to make a script that runs a query and show it to me to see if everything is right and then decide if I finish it or not so I made a little script as below :
      #include <ADO.au3> #include <Array.au3> #include <MsgBoxConstants.au3> #include <AutoItConstants.au3> _ADO_EVENTS_SetUp(True) _ADO_ComErrorHandler_UserFunction(_ADO_COMErrorHandler) Local $sDriver = 'SQL Server' Local $sDatabase = 'DataBase' ; change this string to YourDatabaseName Local $sServer = 'Localhost' ; change this string to YourServerLocation Local $sConnectionString = 'DRIVER={' & $sDriver & '};SERVER=' & $sServer & ';DATABASE=' & $sDatabase & ';UID=' & ';PWD=' & ';' ;~ Global $Query = _ ;~ "BEGIN TRAN" & @CRLF & _ ;~ "UPDATE Table" & @CRLF & _ ;~ "SET HOUR = 4" & @CRLF & _ ;~ "WHERE CUST = 'TEST'" & @CRLF & _ ;~ "SELECT * FROM Table" & @CRLF & _ ;~ "WHERE CUST = 'TEST'" & @CRLF & _ ;~ "ROLLBACK TRAN" Global $Query = _ "BEGIN TRAN" & @CRLF & _ "SELECT * FROM Table" & @CRLF & _ "WHERE CUST = 'TEST'" & @CRLF & _ "ROLLBACK TRAN" _Query_Display($sConnectionString, $Query) Func _Query_Display($sConnectionString, $sQUERY) ; Create connection object Local $oConnection = _ADO_Connection_Create() ; Open connection with $sConnectionString _ADO_Connection_OpenConString($oConnection, $sConnectionString) If @error Then Return SetError(@error, @extended, $ADO_RET_FAILURE) ; Executing some query directly to Array of Arrays (instead to $oRecordset) Local $aRecordset = _ADO_Execute($oConnection, $sQUERY, True) ; Clean Up _ADO_Connection_Close($oConnection) $oConnection = Null ; Display Array Content with column names as headers _ADO_Recordset_Display($aRecordset, 'Query Result') EndFunc ;==> _Query_Display When I ran this script it works great, but when I run the query below :
      Global $Query = _ "BEGIN TRAN" & @CRLF & _ "UPDATE Table" & @CRLF & _ "SET HOUR = 4" & @CRLF & _ "WHERE CUST = 'TEST'" & @CRLF & _ "SELECT * FROM Table" & @CRLF & _ "WHERE CUST = 'TEST'" & @CRLF & _ "ROLLBACK TRAN" It doesn't show anything, when I take those begin and rollback it does what it should but still not showing me anything at all, is there a way around it that you know of?
      Thank you.
    • By Nas
      Hello Guys,
       
      I am running the Ado example script, if I run this line, it runs without errors :
      Local $sConnectionString = 'DRIVER={' & $sDriver & '};SERVER=' & $sServer & ';DATABASE=' & $sDatabase & ';UID=' & $sUser & ';PWD=' & $sPassword & ';' But when I try the windows auth one , it failed everytime :
      Func _Example_MSSQL_WindowsAuthorization() Local $sDatabase = 'AdventureWorks2016' Local $sServer = 'SQLSRV' _Example_5_MSSQL_WinAuth($sServer, $sDatabase, "Select * from Person.Address") EndFunc here is the error :
       
      ADO.au3 v.2.1.16 BETA (1204) : ==> 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:     1204
      $oADO_Error.source is:     ADODB.Connection
      $oADO_Error.helpfile is:     C:\Windows\HELP\ADO270.CHM
      $oADO_Error.helpcontext is:     1240655
      By the way, I have 64x windows server 2016 with SQL Server , I already installed the odbc my sql connector, any thought on this will be greatly appreciate it.
    • By argumentum
      $sQueryUpdateTime = "select intUpdateTime from tblStudies " . $where . " ORDER BY intUpdateTime DESC limit 1"; $rs = mysqli_query($conn, $sQueryUpdateTime); $row = mysqli_fetch_assoc($rs); the above used to take 300+ ms. to query. Then I set it as index and takes 30 ms. Cool.
      $sQuery = "select * from tblStudies " . $where . " ORDER BY StudyDate DESC limit $offset,$rows"; // takes 30 ms. on the indexed int $sQuery = "select * from tblStudies " . $where . " ORDER BY StudyDate DESC , PatientName ASC limit $offset,$rows"; // takes 300 ms. due to "PatientName" been a text field, even as I did index it So my observation is that "PatientName" takes a long time to sort, even tho "$rows = 20". Sorting text in 20 rows should be fast.
      ..tho, I find that any 2nd argument in the ORDER BY is just slow.
      Is there a way to query this in a way to have a faster result back ?
      Thanks
      PS: added ADD INDEX `StudyDate_2` (`StudyDate`, `PatientBirthDate`) USING BTREE;  and searched by those two with not much speed change ( StudyDate and PatientBirthDate are integer ).
    • By buymeapc
      Hello,
      I was looking for a way to use the CLR functions to check a SQL 2016 database state, but I've been unable to find an example that I can get to work. Any help would be appreciated. Here's what I have, which always errors when I try to set the connection string and I'm not sure why. Thanks!
      #include ".\Includes\CLR.au3" #include ".\Includes\CLR Constants.au3" JustATest() Func JustATest() Local $oAssembly = _CLR_LoadLibrary("System.Data") ConsoleWrite("$oAssembly: " & IsObj($oAssembly) & @CRLF) Local $oSQLConn = _CLR_CreateObject($oAssembly, "System.Data.SqlClient.SqlConnection") ConsoleWrite("$oSQLConn: " & IsObj($oSQLConn) & @CRLF) $oSQLConn.ConnectionString = "Server=serverip;Database=dbname;UID=user;PWD=aaaa;" $oSQLConn.Open EndFunc Edit: I am using ptrex's CLR UDF from here:
    • By nooneclose
      Good morning, I am trying to figure out if it is possible to check if these invoice lines exist or not. 
      Here are the table and column name: INVOICELINE.INVOICELINENUM (a required field if created)
      Here is a picture of what I am talking about. (Do not worry about security. the picture is from a demo test site so all information is fake)
       
      is there any way to check if these fields exist or not? (they do not exist unless the user clicks on "New Row")
      Example: line 11 does not exist right now. How would I go about to see if it did or not? 
      This is what I have so far:
      SELECT DISTINCT iv.invoicenum, iv.description FROM invoice AS iv JOIN invoiceline AS ivl ON iv.invoicenum = ivl.invoicenum AND iv.siteid = ivl.siteid /* = 'nothing' and yet somehow not null? */ WHERE iv.invoicenum NOT IN (SELECT invoicelinenum FROM invoiceline WHERE invoicelinenum IS NOT NULL) I get 0 results where I should get more than 0. 
×
×
  • Create New...