Hoox Posted December 3, 2007 Share Posted December 3, 2007 I have made a small simple script that inputs data to a sqlite db. The script works at home but not at my work PC. I get the "AVector: []: Out of bounds." Fatal Error I use AutoIt v3.2.10.0. Both the PC at home and at work is WinXP Pro SP2 US. Here is my code: #include <SQLite.au3> #include <Date.au3> #NoTrayIcon Dim $dataBase = FileGetShortName("F:\WhereAmI\whereami.db") Dim $Time _SQLite_Startup () _SQLite_Open ($dataBase) ; open Database _SQLite_Exec(-1,"BEGIN TRANSACTION") _PopulateColumns() _SQLite_Exec(-1,"COMMIT TRANSACTION") _SQLite_Close() _SQLite_Shutdown() Func _PopulateColumns() $Time = _Now() _SQLite_Exec (-1, "INSERT INTO wai_data (Timestamp,Hostname,Username) VALUES ('"&$Time&"','"&@ComputerName&"','"&@UserName&"');") ; INSERT Data EndFunc The path "F:\WhereAmI\whereami.db" is correct. Checked several times that file exists etc. Can anyone see what could be wrong? Link to comment Share on other sites More sharing options...
Oldschool Posted December 3, 2007 Share Posted December 3, 2007 (edited) I have this problem on my PC too and would also like to know the answer. I was unable to get the SQLite.au3 include to work on my system because of this error and ended up switching to this code also from the forum here, but I forget the authors name... expandcollapse popup;********************************************************************** Func _InvConn() If $__iInvCount = 0 Then SetError(1) EndIf Return $__oInvConn EndFunc ;==>_InvConn ;********************************************************************** ; opens the database ; returns true if db was opened successfully ;********************************************************************** Func _InvOpen() Local Const $sDatabase = "C:\somepath\track.mdb" If $__iInvCount = 0 Then ObjEvent("AutoIt.Error", "__InvCOMErr") $__oInvConn = ObjCreate("ADODB.Connection") $__oInvConn.Provider = "Microsoft.Jet.OLEDB.4.0" $__oInvConn.Open($sDatabase) If Not @error Then $__iInvCount += 1 Return True Else Return False EndIf Else $__iInvCount += 1 Return True EndIf EndFunc ;==>_InvOpen ;********************************************************************** ; closes the database ;********************************************************************** Func _InvClose() If $__iInvCount > 0 Then $__iInvCount -= 1 If $__iInvCount = 0 Then $__oInvConn.Close ObjEvent("AutoIt.Error", "") EndIf EndIf EndFunc ;==>_InvClose ;********************************************************************** ; Returns results of a query into the database ; returns the recordset object itself ; assumes the database is already open ; CursorType: 0 = forward-only recordset ; 2 = updatable recordset ;********************************************************************** Func _InvQueryRS($sQuery, $iCursorType = 0) Local $oRs If $__iInvCount = 0 Then SetError(2) Else $oRs = ObjCreate("ADODB.Recordset") $oRs.CursorType = $iCursorType; adOpenForwardOnly = 0 $oRs.LockType = 3; adLockOptimistic = 3 $oRs.Open($sQuery, $__oInvConn) If @error Then SetError(1) EndIf EndIf Return $oRs EndFunc ;==>_InvQueryRS ;********************************************************************** ; Returns results of a query into the database ; returns an array of strings ; each string is a character separated list of fields returned by the query. ; the default separator character is the comma ; as usual, element 0 is count, like stringsplit ;********************************************************************** Func _InvQuery($sQuery, $sSeparator) Local $oRs, $aResults[1] = [0], $sRecords Local Const $adClipString = 2 If _InvOpen() Then $oRs = _InvQueryRS($sQuery) If Not @error Then $sRecords = $oRs.GetString($adClipString, $oRs.RecordCount, $sSeparator, @CR, '') While StringLen($sRecords) > 0 And StringRight($sRecords, 1) = @CR $sRecords = StringTrimRight($sRecords, 1) WEnd $aResults = StringSplit($sRecords, @CR) $oRs.Close EndIf _InvClose() EndIf Return $aResults EndFunc ;==>_InvQuery ;********************************************************************** Func __InvCOMErr() Local Const $oCOMError = @COM_EventObj Local $sHexNum = Hex($oCOMError.Number, 8) MsgBox(0, @ScriptName, "We intercepted a COM Error !" & @CRLF & _ "On line " & $oCOMError.scriptline & " of the script." & @CRLF & _ "Number is: " & $sHexNum & @CRLF & _ "Windescription is: " & $oCOMError.WinDescription, 10) SetError(1) EndFunc ;==>__InvCOMErr Edited December 3, 2007 by Oldschool Link to comment Share on other sites More sharing options...
picaxe Posted December 3, 2007 Share Posted December 3, 2007 The script works at home but not at my work PC. I get the "AVector: []: Out of bounds." Fatal ErrorSQLite3.dll is missing from the folder that AutoIt is running from or from the windows32 folder. Add this include to your AutoIt program to automatically install SQLite3.dll to the windows32 folder. #include <SQLite.dll.au3> SQLite.dll.au3 can be found here in "SQLite.zip latest version" in \bin\include Link to comment Share on other sites More sharing options...
Hoox Posted December 3, 2007 Author Share Posted December 3, 2007 SQLite3.dll is missing from the folder that AutoIt is running from or from the windows32 folder. Add this include to your AutoIt program to automatically install SQLite3.dll to the windows32 folder. #include <SQLite.dll.au3> SQLite.dll.au3 can be found here in "SQLite.zip latest version" in \bin\include WOW, that did the trick. Thanks alot!! Link to comment Share on other sites More sharing options...
Oldschool Posted December 4, 2007 Share Posted December 4, 2007 SQLite3.dll is missing from the folder that AutoIt is running from or from the windows32 folder. Add this include to your AutoIt program to automatically install SQLite3.dll to the windows32 folder. Link to comment Share on other sites More sharing options...
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