Hallo Zusammen,
ich möchte in einer vorhandenen Datenbank eine Zelle in einer Tabelle ändern. Dafür verwende ich den UPDATE-Befehl. Wenn ich meinen Code wie unten angegeben durchlaufen lassen erhalte ich den SQLite Error Code: 21. Die passende Error Message lautet: Library used incorrectly.
Kann mir vielleicht jemand sagen, wo mein Fehler liegt?
Der Fehler muss mit dem UPDATE-Befehl zusammen hängen, wenn INSERT INTO führt er ordnungsgemäß aus. Den Code dafür habe ich nur eingefügt, damit der Kontext ein wenig klarer wird. Ob das nun notwendig ist um meinen Fehler zu finden weiß ich nicht.
Danke schon mal im vorraus!
AutoIt
Local $sSQLDLL = _SQLite_Startup() ;Laden der SQLite3.dll
If @error Then
MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite3.dll konnte nicht gefunden werden!" & @CRLF & @CRLF & _
"Bitte in einen der folgenden Ordner kopieren " & @SystemDir & ", " & @WindowsDir & ", " & @ScriptDir & ", " & @WorkingDir)
Return
EndIf
Local $hDskDb = _SQLite_Open($Path_Datenbank) ;Öffnen der Baustellendatenbank
If @error Then
MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Fehler beim öffnen der Datenbank!")
Exit -1
EndIf
Local $ReturnValue = _SQLite_Exec($hDskDb, "INSERT INTO Person (Vorname, Nachname, Adresse, PrivMobil, PrivFest, PrivFax, PrivMail, GeschMobil, GeschFest, GeschFax, GeschMail, Geburtsdatum, Firma) VALUES ('" & _
$Dat[1] & "', '" & $Dat[2] & "', '" & Number($Dat[3]) & "', '" & $Dat[9] & "', '" & $Dat[11] & "', '" & $Dat[13] & "', '" & $Dat[7] & "', '" & $Dat[10] & "', '" & $Dat[12] & _
"', '" & $Dat[14] & "', '" & $Dat[8] & "', '" & $Dat[16] & "', '" & $Dat[15] & "');") ; Fügt die Personaldaten der Datenbank hinzu
If $SQLITE_OK <> $ReturnValue Then
MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Error Code: " & _SQLite_ErrCode() & @CRLF & "Error Message: " & _SQLite_ErrMsg())
EndIf
Local $PersID = _SQLite_LastInsertRowID()
$ReturnValue = _SQLite_Exec(-1, "UPDATE Firma SET Personal = " & _SQLite_FastEscape($PersID) & " WHERE FirmenID = " & Number($FirID) & " ;")
If $SQLITE_OK <> $ReturnValue Then
MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Error Code: " & _SQLite_ErrCode() & @CRLF & "Error Message: " & _SQLite_ErrMsg())
EndIf
Alles anzeigen