Sign in to follow this  
Followers 0
faustf

Sqlite3 update syntax

2 posts in this topic

#1 ·  Posted

hi guys , i try to update a sqlite db i  create  this  script  but  i think the _SQLite_Exec is not correct  , return  not an error , but not upload  the data

Func _Sqlite3_Update($sDB, $sTable, $sColumn, $sDataSQL, $sColumFind, $Id_change)

    _SQLite_Startup()
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite3.dll Can't be Loaded!" & @CRLF & @CRLF & _
                "Not FOUND in @SystemDir, @WindowsDir, @ScriptDir, @WorkingDir, @LocalAppDataDir\AutoIt v3\SQLite")
        ; Exit -1
    EndIf
    Local $DB = _SQLite_Open($sDB)
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't create a memory Database!")
        ;Exit -1
    EndIf
    $SQLUPDATESTRING = "UPDATE " & $sTable & " SET " & $sColumn & " = " & _SQLite_Escape($sDataSQL) & " WHERE " & $sColumFind & " = " & _SQLite_Escape($Id_change) & ";"

    ConsoleWrite($SQLUPDATESTRING)
    _SQLite_Exec($sDB, $SQLUPDATESTRING)
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg(-1))
        ;Exit -1
    EndIf
    _SQLite_Close()
    _SQLite_Shutdown()

EndFunc   ;==>_Sqlite3_Update

--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
UPDATE All_Cat SET depop_cat = '1_dalla cinta in su' WHERE id = '1';

anyone can help me??

 

Share this post


Link to post
Share on other sites



#2 ·  Posted

i correct  a code now  work

Func _Sqlite3_Update($sDB, $sTable, $sColumn, $sDataSQL, $sColumFind, $Id_change)

    _SQLite_Startup()
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite3.dll Can't be Loaded!" & @CRLF & @CRLF & _
                "Not FOUND in @SystemDir, @WindowsDir, @ScriptDir, @WorkingDir, @LocalAppDataDir\AutoIt v3\SQLite")
        ; Exit -1
    EndIf
    Local $DB = _SQLite_Open($sDB)
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't create a memory Database!")
        ;Exit -1
    EndIf
    $SQLUPDATESTRING = "UPDATE " & $sTable & " SET " & $sColumn & " = " & _SQLite_Escape($sDataSQL) & " WHERE " & $sColumFind & " = " & $Id_change & ";"

    ConsoleWrite($SQLUPDATESTRING)
    _SQLite_Exec(-1, $SQLUPDATESTRING)
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg(-1))
        ;Exit -1
    EndIf
    _SQLite_Close()
    _SQLite_Shutdown()

EndFunc   ;==>_Sqlite3_Update

 

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
Sign in to follow this  
Followers 0