mLipok Posted April 26, 2017 Author Posted April 26, 2017 but this is wrong: $ADO_Alive = __ADO_Connection_IsReady(ByRef $oConnection) try this: $ADO_Alive = __ADO_Connection_IsReady($oConnection) 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 Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.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 TaskScheduler * IE 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 stuff * OnHungApp handler * Avoid "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" , 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
Skysnake Posted April 26, 2017 Posted April 26, 2017 ; test to see if connection is ready: Func __ADO_Connection_IsReady(ByRef $oConnection) Local $ADO_Alive $ADO_Alive = __ADO_Connection_IsReady($oConnection) ConsoleWrite("At " & _Now() & " connection returned " & $ADO_Alive & @CRLF) Returns At 26-Apr-17 2:05:45 PM connection returned 1 Skysnake Why is the snake in the sky?
mLipok Posted April 26, 2017 Author Posted April 26, 2017 (edited) @Skysnake I'm a little a bit tired, and I do not want to work today night to much (hahaha - self criticism) so I'm going to ask you straight. Can you confirm that recent issues have been resolved by my replies ? Edited April 26, 2017 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 Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.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 TaskScheduler * IE 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 stuff * OnHungApp handler * Avoid "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" , 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
rm65453 Posted April 26, 2017 Posted April 26, 2017 (edited) Hello everyone, I am trying to use example one and an getting an error ElseIf StringInStr(ObjName($oObjectToCheck, $OBJ_PROGID), $sRequiredProgID) = 0 Then ElseIf StringInStr(ObjName($oObjectToCheck, ^ ERROR here is my code expandcollapse popup#include "ADO.au3" #Tidy_Parameters=/sort_funcs /reel #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 #include <Array.au3> #include <MsgBoxConstants.au3> #include <AutoItConstants.au3> Global $sDSN = 'PostgreSQL35W' Global $sDatabase = 'databasename' Global $sServer = '127.0.0.1' //have also tried localhost Global $sPort = '3306' Global $sUser = 'username here' Global $sPassword = 'password here' ; Internal ADO.au3 UDF COMError Handler _ADO_ComErrorHandler_UserFunction(_ADO_COMErrorHandler) Func _Example1() Local $sConnectionString = 'DSN=' & $sDSN & ';DATABASE=' & $sDatabase & ';SERVER=' & $sServer & ';PORT=' & $sPort & ';UID=' & $sUser & ';PWD=' & $sPassword & ';' Local $oConnection = _ADO_Connection_Create() _ADO_Connection_OpenConString($oConnection, $sConnectionString) If @error Then Return SetError(@error, @extended, $ADO_RET_FAILURE) Local $sTableName = 'orderenty' Local $sQUERY = 'Select * from ' & $sTableName Local $oRecordset = _ADO_Execute($oConnection, $sQUERY) Local $aRecordsetArray = _ADO_Recordset_ToArray($oRecordset, False) Local $aRecordset_inner = _ADO_RecordsetArray_GetContent($aRecordsetArray) Local $iColumn_count = UBound($aRecordset_inner, $UBOUND_COLUMNS) For $iRecord_idx = 0 To UBound($aRecordset_inner) - 1 ConsoleWrite('==================================================================' & @CRLF) For $iColumn_idx = 0 To $iColumn_count - 1 ConsoleWrite($aRecordset_inner[$iRecord_idx][$iColumn_idx] & @CRLF) Next Next ; CleanUp $oRecordset = Null _ADO_Connection_Close($oConnection) $oConnection = Null EndFunc Edited April 26, 2017 by rm65453 formatting issues.
mLipok Posted April 26, 2017 Author Posted April 26, 2017 Which AutoIt version you are using ? btw. please read this: * How to post code on the forum * 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 Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.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 TaskScheduler * IE 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 stuff * OnHungApp handler * Avoid "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" , 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
rm65453 Posted April 26, 2017 Posted April 26, 2017 Sorry about the formatting issues, not sure what I was thinking. I was using "SciTE-Lite Version 3.4.1 Jun 1 2014 18:45:52" Then switched to using "SciTE-Lite Version 3.5.4 Sep 18 2015 15:04:36" now I get this error Quote ############################### ADO.au3 v.2.1.13 BETA (1071) : ==> 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. I have checked the information and the information I have entered is correct.
mLipok Posted April 26, 2017 Author Posted April 26, 2017 (edited) Newest SciTE4Au3 is here: But I was asking about AutoIt version. btw. You said: ElseIf StringInStr(ObjName($oObjectToCheck, $OBJ_PROGID), $sRequiredProgID) = 0 Then ElseIf StringInStr(ObjName($oObjectToCheck, ^ ERROR This is not entire description for this issue. Please post entire console output from SciTE Console. EDIT: If you are trying to connect to PostgreSQL Global $sDSN = 'PostgreSQL35W' Then you should have instaled proper driver, as you have not instaled the selected one, ODBC is showing you related error description: Quote $oADO_Error.description is: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified Edited April 26, 2017 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 Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.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 TaskScheduler * IE 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 stuff * OnHungApp handler * Avoid "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" , 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
rm65453 Posted April 26, 2017 Posted April 26, 2017 Thanks for your help. I found mysql.au3 which is actually working well for me.
mLipok Posted April 26, 2017 Author Posted April 26, 2017 You're welcome. So on the margins to use MySQL with ADO also need to install a suitable driver. 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 Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.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 TaskScheduler * IE 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 stuff * OnHungApp handler * Avoid "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" , 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
Skysnake Posted April 27, 2017 Posted April 27, 2017 (edited) I have changed this Func __ADO_Recordset_IsNotEmpty(ByRef $oRecordset) ; Error handler, automatic cleanup at end of function Local $oADO_COM_ErrorHandler = ObjEvent("AutoIt.Error", __ADO_ComErrorHandler_InternalFunction) If @error Then Return SetError($ADO_ERR_COMHANDLER, @error, $ADO_RET_FAILURE) #forceref $oADO_COM_ErrorHandler __ADO_Recordset_IsReady($oRecordset) If @error Then Return SetError(@error, @extended, $ADO_RET_FAILURE) ;` was ElseIf $oRecordset.bof = -1 And $oRecordset.eof = True Then ; no current record ElseIf $oRecordset.bof And $oRecordset.eof Then ; no current record Return SetError($ADO_ERR_NOCURRENTRECORD, $ADO_EXT_DEFAULT, $ADO_RET_FAILURE) ;ElseIf $oRecordset.RecordCount = 0 Then ; Return SetError($ADO_ERR_RECORDSETEMPTY, $ADO_EXT_DEFAULT, $ADO_RET_FAILURE) EndIf Return SetError($ADO_ERR_SUCCESS, $ADO_EXT_DEFAULT, $ADO_RET_SUCCESS) EndFunc ;==>__ADO_Recordset_IsNotEmpty $query = " PREPARE mtc_ins " ... $aResult = _ADO_Execute($g_DB, $query, True, True) If @error Then SetError(@error, @extended, $ADO_RET_FAILURE) MsgBox($MB_SYSTEMMODAL, "ADO SQL Error: " & $ADO_RET_FAILURE, '@error = ' & @error & @CRLF & '@extended = ' & @extended & @CRLF & $QUERY & @CRLF) EndIf Returns ############################### ADO.au3 v.2.1.13 BETA (1259) : ==> COM Error intercepted ! $oADO_Error.description is: The # of binded parameters < the # of parameter markers $oADO_Error.windescription: Exception occurred. $oADO_Error.number is: 80020009 $oADO_Error.lastdllerror is: 0 $oADO_Error.scriptline is: 1259 $oADO_Error.source is: Microsoft OLE DB Provider for ODBC Drivers $oADO_Error.helpfile is: $oADO_Error.helpcontext is: 0 ############################### You may PM me an update, I will check first. Thanks for your effort. Skysnake Edited April 27, 2017 by Skysnake Skysnake Why is the snake in the sky?
Skysnake Posted April 27, 2017 Posted April 27, 2017 Next question - I have now tried to select a value that does not exist and obtained an "@error = 13" message. Where can I see what error 13 means? Skysnake Why is the snake in the sky?
Skysnake Posted April 27, 2017 Posted April 27, 2017 Error logging I am trying to log errors. I have done this expandcollapse popupFunc _ADO_COMErrorHandler(ByRef $oADO_Error) If @Compiled Then Return SetError($ADO_ERR_SUCCESS, $ADO_EXT_DEFAULT, $ADO_RET_SUCCESS) ; Error Object ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms677507(v=vs.85).aspx ; Error Object Properties, Methods, and Events ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms678396(v=vs.85).aspx Local $HexNumber = Hex($oADO_Error.number, 8) Local $sSQL_ComErrorDescription = '' $sSQL_ComErrorDescription &= "ADO.au3 v." & _ADO_UDFVersion() & " (" & $oADO_Error.scriptline & ") : ==> COM Error intercepted !" & @CRLF $sSQL_ComErrorDescription &= "$oADO_Error.description is: " & @TAB & $oADO_Error.description & @CRLF $g_AdoErrDesc = $oADO_Error.description $sSQL_ComErrorDescription &= "$oADO_Error.windescription: " & @TAB & $oADO_Error.windescription & @CRLF $sSQL_ComErrorDescription &= "$oADO_Error.number is: " & @TAB & @TAB & $HexNumber & @CRLF $sSQL_ComErrorDescription &= "$oADO_Error.lastdllerror is: " & @TAB & $oADO_Error.lastdllerror & @CRLF $sSQL_ComErrorDescription &= "$oADO_Error.scriptline is: " & @TAB & $oADO_Error.scriptline & @CRLF ; Source Property (ADO Error) ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms675830(v=vs.85).aspx $sSQL_ComErrorDescription &= "$oADO_Error.source is: " & @TAB & @TAB & $oADO_Error.source & @CRLF $sSQL_ComErrorDescription &= "$oADO_Error.helpfile is: " & @TAB & $oADO_Error.helpfile & @CRLF $sSQL_ComErrorDescription &= "$oADO_Error.helpcontext is: " & @TAB & $oADO_Error.helpcontext & @CRLF #cs ; NativeError Property (ADO) ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms678049(v=vs.85).aspx $sSQL_ComErrorDescription &= "$oADO_Error.NativeError is: " & @TAB & $oADO_Error.NativeError & @CRLF ; SQLState Property ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms681570(v=vs.85).aspx $sSQL_ComErrorDescription &= "$oADO_Error.SQLState is: " & @TAB & $oADO_Error.SQLState & @CRLF #CE ConsoleWrite("############################### ADO ERROR " & @CRLF & $sSQL_ComErrorDescription & "###############################" & @CRLF) _FileWriteLog($LogErr, @CRLF & "############################### ADO ERROR " & @CRLF & $sSQL_ComErrorDescription & "###############################" & @CRLF) ; SetError($ADO_ERR_GENERAL, $ADO_EXT_DEFAULT, $sSQL_ComErrorDescription) EndFunc ;==>_ADO_COMErrorHandler I have also updated my standard query to look like this Local $aResult = _ADO_Execute($g_DB, $query, True, True) If @error Then SetError(@error, @extended, $ADO_RET_FAILURE) $ADOErr = @error $ADOExtErr = @extended MsgBox($MB_SYSTEMMODAL, "ADO SQL Error: " & $ADO_RET_FAILURE, $g_AdoErrDesc & " * " & @CRLF & '@error = ' & @error & @CRLF & '@extended = ' & @extended & @CRLF & $QUERY & @CRLF) _FileWriteLog($LogErr, @CRLF & '------------------------------------------------ SQL ERROR ' & "Error: " & $ADOErr & " * " & "Extended: " & $ADOExtErr & " * " & "ADO Returned " & $ADO_RET_FAILURE & @CRLF & $query & @CRLF) $ADOErr = 0 $ADOExtErr = 0 EndIf I seem to be getting 3 different kinds of errors. COM errors, which are serious. ADO Errors and SQL errors. I do not quite understand what happens first. Output looks like this expandcollapse popup2017-04-27 18:49:31 : -----------------------------------------------------------------------Error: 13 * Extended: 0ADO Returned -1 SELECT clntacc as clnt, clntname from myclnt WHERE clntacc ='00004'; 2017-04-27 18:49:31 : ADO ERROR ############################### ADO.au3 v.2.1.13 BETA (1259) : ==> COM Error intercepted ! $oADO_Error.description is: The # of binded parameters < the # of parameter markers $oADO_Error.windescription: Exception occurred. $oADO_Error.number is: 80020009 $oADO_Error.lastdllerror is: 0 $oADO_Error.scriptline is: 1259 $oADO_Error.source is: Microsoft OLE DB Provider for ODBC Drivers $oADO_Error.helpfile is: $oADO_Error.helpcontext is: 0 ############################### 2017-04-27 18:49:33 : -----------------------------------------------------------------------Error: 2 * Extended: -2147352567ADO Returned -1 PREPARE insert2myclnt (text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, real, text, text, text ) AS INSERT INTO mtC ( mtC_ACNO, mtC_Name, mtC_CRef, mtC_Party1, mtC_Party2, mtC_Matter, mtC_Cmmnt, mtC_email, mtC_Tel, mtC_Fax, mtC_cell, mtC_VAT, mtC_Ad1, mtC_Ad2, mtC_Ad3, mtC_Lgc, mtC_Link, mtC_Attorney, mtC_Dpt, mtC_Type, mtC_Archive, mtC_Sts, mtC_LdgT, mtC_Amnt, mtC_OpenDate , mtC_Attrib123, mtC_AttribABC ) values ( $1, $2, $3, $4, $5, $6 , $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25 , $26, $27 ) ; 2017-04-27 18:49:34 : ADO ERROR ############################### ADO.au3 v.2.1.13 BETA (1259) : ==> COM Error intercepted ! $oADO_Error.description is: ERROR: prepared statement "mtc_ins" does not exist; Error while executing the query $oADO_Error.windescription: Exception occurred. $oADO_Error.number is: 80020009 $oADO_Error.lastdllerror is: 0 $oADO_Error.scriptline is: 1259 $oADO_Error.source is: Microsoft OLE DB Provider for ODBC Drivers $oADO_Error.helpfile is: $oADO_Error.helpcontext is: 0 ############################### 2017-04-27 18:49:35 : -----------------------------------------------------------------------Error: 2 * Extended: -2147352567ADO Returned -1 EXECUTE insert2myclnt ( '00004', 'dfvhk', 'v jf', 'First name', 'Second name', 'Diagnosis', 'Comment', '', '', '', '', 'None', '', '', '', 'Personal', '', '12345', 'GEN', 'LCM', 'TBA', '1 Active', 'Z123', '0.00', '2017-04-27', '1100000000', 'abcdefghij' ) ; 2017-04-27 18:54:42 : ------------------------------------------------ SQL ERROR Error: 13 * Extended: 0 * ADO Returned -1 SELECT mtC_ACNO as acno, mtc_name from mtC WHERE mtC_ACNO='00004'; 2017-04-27 18:54:42 : ############################### ADO ERROR ADO.au3 v.2.1.13 BETA (1259) : ==> COM Error intercepted ! $oADO_Error.description is: The # of binded parameters < the # of parameter markers $oADO_Error.windescription: Exception occurred. $oADO_Error.number is: 80020009 $oADO_Error.lastdllerror is: 0 $oADO_Error.scriptline is: 1259 $oADO_Error.source is: Microsoft OLE DB Provider for ODBC Drivers $oADO_Error.helpfile is: $oADO_Error.helpcontext is: 0 ############################### 2017-04-27 18:54:43 : ------------------------------------------------ SQL ERROR Error: 2 * Extended: -2147352567 * ADO Returned -1 PREPARE mtc_ins (text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, real, text, text, text ) AS INSERT INTO mtC ( mtC_ACNO, mtC_Name, mtC_CRef, mtC_Party1, mtC_Party2, mtC_Matter, mtC_Cmmnt, mtC_email, mtC_Tel, mtC_Fax, mtC_cell, mtC_VAT, mtC_Ad1, mtC_Ad2, mtC_Ad3, mtC_Lgc, mtC_Link, mtC_Attorney, mtC_Dpt, mtC_Type, mtC_Archive, mtC_Sts, mtC_LdgT, mtC_Amnt, mtC_OpenDate , mtC_Attrib123, mtC_AttribABC ) values ( $1, $2, $3, $4, $5, $6 , $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25 , $26, $27 ) ; 2017-04-27 18:54:44 : ############################### ADO ERROR ADO.au3 v.2.1.13 BETA (1259) : ==> COM Error intercepted ! $oADO_Error.description is: ERROR: prepared statement "mtc_ins" does not exist; Error while executing the query $oADO_Error.windescription: Exception occurred. $oADO_Error.number is: 80020009 $oADO_Error.lastdllerror is: 0 $oADO_Error.scriptline is: 1259 $oADO_Error.source is: Microsoft OLE DB Provider for ODBC Drivers $oADO_Error.helpfile is: $oADO_Error.helpcontext is: 0 ############################### 2017-04-27 18:54:45 : ------------------------------------------------ SQL ERROR Error: 2 * Extended: -2147352567 * ADO Returned -1 EXECUTE mtc_ins ( '00004', 'saldfmn', 'dlnb', 'First Party on this file', 'Second Party on this file', 'Matter Detail Description', 'Comment', '', '', '', '', 'None', '', '', '', 'Old Number', '', '90000', 'GEN', 'LIT', 'TBA', '1 Active', 'TLBJ', 'R0.00', '2017-04-27', '1100000000', 'abcdefghij' ) ; It seems ADO always returns -1 ... as mentioned some time ago? Skysnake Skysnake Why is the snake in the sky?
Skysnake Posted April 27, 2017 Posted April 27, 2017 PREPARE statement does not work ############################### ADO ERROR ADO.au3 v.2.1.13 BETA (1259) : ==> COM Error intercepted ! $oADO_Error.description is: The # of binded parameters < the # of parameter markers $oADO_Error.windescription: Exception occurred. $oADO_Error.number is: 80020009 $oADO_Error.lastdllerror is: 0 $oADO_Error.scriptline is: 1259 $oADO_Error.source is: Microsoft OLE DB Provider for ODBC Drivers $oADO_Error.helpfile is: $oADO_Error.helpcontext is: 0 ############################### 2017-04-27 20:26:18 : ------------------------------------------------ SQL ERROR Error: 2 * Extended: -2147352567 * ADO Returned -1 PREPARE myinsert (text, text, text, text ) AS INSERT INTO mytable ( myacc, myName, myRef, mysrnm ) values ( $1, $2, $3, $4 ) ; The number of binded parameters = the # of parameter markers Skysnake Skysnake Why is the snake in the sky?
mLipok Posted April 27, 2017 Author Posted April 27, 2017 (edited) Sorry I'm little busy at businness trip. Currently going to bed in hotel. I hope I will be able to answer in saturday or sunday. But before I go sleep still I have few things on my TODO list. Edited April 27, 2017 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 Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.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 TaskScheduler * IE 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 stuff * OnHungApp handler * Avoid "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" , 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
Skysnake Posted April 28, 2017 Posted April 28, 2017 (edited) @mLipok, READ THIS FIRST I have summarized all the problems above into this script. You only need to insert the $g_AdoErrDesc = $oADO_Error.description into the Func _ADO_COMErrorHandler(ByRef $oADO_Error) This script will run and connect. The connection is live. Feel free to update 'skysnake' with username of your choice... expandcollapse popupGlobal $g_AdoErrDesc #include "ADO.au3" #include <File.au3> #Tidy_Parameters=/sort_funcs /reel #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 #include <Array.au3> #include <MsgBoxConstants.au3> #include <AutoItConstants.au3> Global $oCon = Null ; $oConnection ; SetUP internal ADO.au3 UDF COMError Handler _ADO_ComErrorHandler_UserFunction(_ADO_COMErrorHandler) _Example_PostgreSQL_online() ; :) Func _Example_PostgreSQL_online() Local $sDSN = 'PostgreSQL35W' ; Default Local $sDatabase = 'fred' ; db name --- default 'postgres' Local $sServer = '199.19.213.182' ; Server IP Local $sPort = '6432' ; Port Local $sUser = 'fred' ; PostGre Username Local $sPassword = 'fred' ; PostGre User Password Local $sConnectionString = 'DSN=' & $sDSN & ';DATABASE=' & $sDatabase & ';SERVER=' & $sServer & ';PORT=' & $sPort & ';UID=' & $sUser & ';PWD=' & $sPassword & ';' Local $ADOErr, $ADOExtErr, $LogErr = @ScriptDir & "\ErrorLog.txt" ConsoleWrite("_Example_PostgreSQL " & $sConnectionString & @CRLF) ; 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) $oCon = $oConnection Local $Query, $aQresult, $aResult, $Qresult $Query = '' $Query = "insert into t_log_access (uname) values ('Skysnake was here') ;" $aResult = _ADO_Execute($oCon, $Query, True, True) If @error Then SetError(@error, @extended, $ADO_RET_FAILURE) $ADOErr = @error $ADOExtErr = @extended MsgBox($MB_SYSTEMMODAL, "ADO SQL Error: " & $ADO_RET_FAILURE, $g_AdoErrDesc & " * " & @CRLF & '@error = ' & @error & @CRLF & '@extended = ' & @extended & @CRLF & $Query & @CRLF) _FileWriteLog($LogErr, @CRLF & '------------------------------------------------ SQL ERROR ' & "Error: " & $ADOErr & " * " & "Extended: " & $ADOExtErr & " * " & "ADO Returned " & $ADO_RET_FAILURE & @CRLF & $Query & @CRLF) $ADOErr = 0 $ADOExtErr = 0 EndIf ; like SQLite_Exec If Not _ADO_Execute($oCon, "CREATE temp TABLE persons (Name text, Age int);") = $ADO_ERR_SUCCESS Then ConsoleWrite("5a @ERROR " & @error & @CRLF) ConsoleWrite("5b @ERROR " & @error & @CRLF) ConsoleWrite("5c @extended " & @extended & @CRLF) Else MsgBox($MB_SYSTEMMODAL, "5. ADO Okay", $ADO_ERR_SUCCESS) EndIf ; like SQLite_GetTable2d $Query = "Select * from t_log_access order by 2 desc limit 5; " ;$aQresult = _ADO_Execute($oCon, $Query, True) $aResult = _ADO_Execute($oCon, $Query, True, True) If @error Then SetError(@error, @extended, $ADO_RET_FAILURE) $ADOErr = @error $ADOExtErr = @extended MsgBox($MB_SYSTEMMODAL, "ADO SQL Error: " & $ADO_RET_FAILURE, $g_AdoErrDesc & " * " & @CRLF & '@error = ' & @error & @CRLF & '@extended = ' & @extended & @CRLF & $Query & @CRLF) _FileWriteLog($LogErr, @CRLF & '------------------------------------------------ SQL ERROR ' & "Error: " & $ADOErr & " * " & "Extended: " & $ADOExtErr & " * " & "ADO Returned " & $ADO_RET_FAILURE & @CRLF & $Query & @CRLF) $ADOErr = 0 $ADOExtErr = 0 EndIf ConsoleWrite(_ArrayDisplay($aResult)) ; PREPAREd statement $Query = "PREPARE myloginsert (text ) AS INSERT INTO t_log_access (uname ) values ( $1 ) ; " ;$aQresult = _ADO_Execute($oCon, $Query, True) $aResult = _ADO_Execute($oCon, $Query, True, True) If @error Then SetError(@error, @extended, $ADO_RET_FAILURE) $ADOErr = @error $ADOExtErr = @extended MsgBox($MB_SYSTEMMODAL, "ADO SQL Error: " & $ADO_RET_FAILURE, $g_AdoErrDesc & " * " & @CRLF & '@error = ' & @error & @CRLF & '@extended = ' & @extended & @CRLF & $Query & @CRLF) _FileWriteLog($LogErr, @CRLF & '------------------------------------------------ SQL ERROR ' & "Error: " & $ADOErr & " * " & "Extended: " & $ADOExtErr & " * " & "ADO Returned " & $ADO_RET_FAILURE & @CRLF & $Query & @CRLF) $ADOErr = 0 $ADOExtErr = 0 EndIf $Query = "EXECUTE myloginsert ('skysnake from a prepared statement' ) ; " ;$aQresult = _ADO_Execute($oCon, $Query, True) $aResult = _ADO_Execute($oCon, $Query, True, True) If @error Then SetError(@error, @extended, $ADO_RET_FAILURE) $ADOErr = @error $ADOExtErr = @extended MsgBox($MB_SYSTEMMODAL, "ADO SQL Error: " & $ADO_RET_FAILURE, $g_AdoErrDesc & " * " & @CRLF & '@error = ' & @error & @CRLF & '@extended = ' & @extended & @CRLF & $Query & @CRLF) _FileWriteLog($LogErr, @CRLF & '------------------------------------------------ SQL ERROR ' & "Error: " & $ADOErr & " * " & "Extended: " & $ADOExtErr & " * " & "ADO Returned " & $ADO_RET_FAILURE & @CRLF & $Query & @CRLF) $ADOErr = 0 $ADOExtErr = 0 EndIf ConsoleWrite("$Query " & $Query & @CRLF) ConsoleWrite("$aQresult " & $aQresult & @CRLF) ConsoleWrite("$aResult " & $aResult & @CRLF) ConsoleWrite("$Qresult " & $Qresult & @CRLF) EndFunc ;==>_Example_PostgreSQL_online Thank you. Enjoy the trip and the weekend. Skysnake NOTICE - this link will expire at the end of May 2017 Edited May 12, 2017 by Skysnake Expiry notice Skysnake Why is the snake in the sky?
Skysnake Posted May 12, 2017 Posted May 12, 2017 the server in post #295 will go offline at the end of May 2017. If you want to play with ADO and PostgreSQL online, this is the last opportunity. Skysnake Skysnake Why is the snake in the sky?
markd89 Posted May 12, 2017 Posted May 12, 2017 Hi, I'm not an ADO expert :-( I got the _Example_MSSQL() to work OK. When I try _Example_MSSQL_COMMAND_StoredProcedure(), I always get a Messagebox with title @Result1 and no content. I tried hacking on this for a while, including having it create the Proc as testing1 rather than #testing1. I could then easily modify and test the proc directly in SQL and get it to return results, but still could not get AutoIT to do the same with that proc. I'm not sure if the example is broken or I am doing something wrong, or both ;-) My project should be pretty easy. I just need to EXEC a stored procedure passing it some parameters and then get the result into a string variable. My result is a single value -- not several fields, not several rows. Any suggestions or more simple examples would be greatly appreciated!! Thanks! Mark
mLipok Posted May 12, 2017 Author Posted May 12, 2017 On 28.04.2017 at 1:37 PM, Skysnake said: @mLipok, READ THIS FIRST I have summarized all the problems above into this script. You only need to insert the $g_AdoErrDesc = $oADO_Error.description into the Func _ADO_COMErrorHandler(ByRef $oADO_Error) This script will run and connect. The connection is live. Feel free to update 'skysnake' with username of your choice... NOTICE - this link will expire at the end of May 2017 Why you use SetError() here: If @error Then SetError(@error, @extended, $ADO_RET_FAILURE) $ADOErr = @error $ADOExtErr = @extended MsgBox($MB_SYSTEMMODAL, "ADO SQL Error: " & This is useless because of MsgBox() is setting new @error and @extended values. 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 Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.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 TaskScheduler * IE 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 stuff * OnHungApp handler * Avoid "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" , 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
Skysnake Posted May 15, 2017 Posted May 15, 2017 Copied that code from somewhere. The idea is to capture the error values into the vars $ADOErr and $ADOExtErr to keep their values. I see you have not run the script. When can we expect a new version of ADO UDF? Skysnake Why is the snake in the sky?
Skysnake Posted May 16, 2017 Posted May 16, 2017 When can we expect a new version of ADO UDF? Skysnake Skysnake Why is the snake in the sky?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now