Android Question jdbcSQL UPDATE

sigster

Active Member
Licensed User
Longtime User
Hi

I am try to UPDATE I get no error and the data don't change

are any example how to INSERT, UPDATE using jdbcSQL and MYSQL


B4X:
Dim sf As Object = Starter.mysql.ExecQueryAsync("mysql","UPDATE testtable SET id=?,name=? ,address=? WHERE id=? ", _
                                Array As Object("","name","address","1", Null))   
    Wait For (sf) mysql_QueryComplete (Success As Boolean, Crsr As JdbcResultSet)


1594200735376.png
 

DonManfred

Expert
Licensed User
Longtime User
id is autoincrement. You can NOT SET a value for it

Dim sf As Object = Starter.mysql.ExecQueryAsync("mysql","UPDATE testtable SET id=?,name=? ,address=? WHERE id=? ", _ Array As Object("","name","address","1", Null))
so the 1st ? is not right. Even the query and parameters
B4X:
Dim sf As Object = Starter.mysql.ExecQueryAsync("mysql","UPDATE testtable SET name=? ,address=? WHERE id=? ", _ Array As Object("name","address","1"))
 
Last edited:
Upvote 0

sigster

Active Member
Licensed User
Longtime User
Thanks

the data still don't upgrade

B4X:
    If Starter.mysql.IsInitialized = False Then
        Wait For (CallSub(Starter,"Connect")) Complete (Success As Boolean)
        If Success Then
            Log("Connected")       
        End If
    Else
        Log("No")
    End If
    
    Dim sf As Object = Starter.mysql.ExecQueryAsync("mysql","UPDATE testtable SET name=? ,address=? WHERE id=? ", Array As Object("name1","address1","1"))
    Wait For (sf) mysql_QueryComplete (Success As Boolean, Crsr As JdbcResultSet)
    
    If Success Then
        Log("1")
        Else
        Log("2")
    End If
 
Upvote 0

sigster

Active Member
Licensed User
Longtime User
I am not Experts any change you can help me with this

Invalid number of parentheses

B4X:
Starter.mysql.ExecNonQuery2("mysql", "UPDATE testtable SET name=? ,address=? WHERE id=? ", Array As Object("name1","address1","1", Null)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Oh my god....I suggest to learn the basics.. You have two opening "(" but only one closing ")"

Add a ) at the end.

Expect this my last answer.

Last Note: REMOVE the null in your parameters! You have 3 questionsmarks (?) but you give FOUR parameters. I already fixed this problem above.
Your query was ok in #3. But now you added null again. Why?
 
Last edited:
Upvote 0

sigster

Active Member
Licensed User
Longtime User
I can close this like this but not if I use "mysql", "UPDATE

Communications link failure if I skip "mysql"
B4X:
Starter.mysql.ExecNonQuery2("UPDATE testtable SET name=? ,address=? WHERE id=? ", Array As Object("name1","address1","1"))
 
Upvote 0
Top