xueshan007050 Posted March 13, 2013 Posted March 13, 2013 I have got a problem,ask some help when I run this script,get errors #include <SQLite.au3> #include <Excel.au3> #include <Array.au3> #include <DBOperate.au3> #include <String.au3> #include <ADO Constants.au3> ;Open the Database $sqlCon=ObjCreate("ADODB.Connection") $conDSN=("DRIVER={SQL Server};SERVER=10.30.12.203;DATA3ASE=MSDB;UID=Sa;PWD=LC1234,;") $sqlCon.Open($conDSN) ;_SQLite_Exec(-1,"INSERT INTO [MT_BUGMANAGEMENTDB].[dbo].[bUGLIST] (LISTID) VALUES ("15")") $sqlCon.Execute("INSERT INTO [MT_BUGMANAGEMENTDB].[dbo].[bUGLIST] (LISTID) VALUES ('15')") when i run this script,get error like this C:\Users\Administrator\Desktop\BugMangment_SQL.au3 (47) : ==> The requested action with this object has failed.: $sqlCon.Execute("INSERT INTO [MT_BUGMANAGEMENTDB].[dbo].[bUGLIST] (LISTID) VALUES ('15')") $sqlCon.Execute("INSERT INTO [MT_BUGMANAGEMENTDB].[dbo].[bUGLIST] (LISTID) VALUES ('15')")^ ERROR ->16:25:45 AutoIT3.exe ended.rc:1 >Exit code: 1 Time: 4.027
skysel Posted March 13, 2013 Posted March 13, 2013 (edited) $sqlCon.Execute("INSERT INTO [MT_BUGMANAGEMENTDB].[dbo].[BUGLIST] (LISTID) VALUES ('" & "15" & "')")" Try this, it's tricky when it comes to ' and " Edited March 13, 2013 by skysel
xueshan007050 Posted March 13, 2013 Author Posted March 13, 2013 thanks skysel $sqlCon.Execute("INSERT INTO [MT_BUGMANAGEMENTDB].[dbo].[BUGLIST] (LISTID) VALUES ('" & "15" & "')")" Try this, it's tricky when it comes to ' and " thank s skysel. The question had solved. use this method ;Open the Database $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $sqlCon=ObjCreate("ADODB.Connection") $conDSN=("DRIVER={SQL Server};SERVER=10.30.12.203;DATA3ASE=MSDB;UID=Sa;PWD=LC1234,;") $sqlCon.Open($conDSN) _SQLite_Exec(-1,"INSERT INTO [MT_BUGMANAGEMENTDB].[dbo].[bUGLIST] (LISTID) VALUES ("15")") If @error Then ConsoleWrite("ObjOpen Failed dude ") Else ConsoleWrite("ObjOpen Success!! hahaha we did it , Query away ") EndIf Func MyErrFunc() ConsoleWrite("AutoItCOM Test" & @CRLF & "We intercepted a COM Error !" & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & Hex($oMyError.number, 8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext & @CRLF ) ;"err $sqlString is:" & @TAB &$sqlString& @CRLF ) SetError(1) EndFunc ;==>MyErrFunc
jchd Posted March 13, 2013 Posted March 13, 2013 You are mixing DB engines! You just can't connect to an MS SQL engine then query it using the SQLite engine. If you need to connect to different SQL engines, then show all the relevant code. Else stick with one engine at a time. Also whay's this DBoperate.au3 include? Just curious. Same for ADO constants.au3 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 hereRegExp tutorial: enough to get startedPCRE 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)
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