Android Question Fill in a NULL field

andredamen

Active Member
Licensed User
Longtime User
Can someone help me?

B4X:
    If TableColumnExists(DBTableName3, "veld") =False Then
       SQL1.ExecNonQuery("ALTER TABLE programma ADD veld TEXT")
    End If


    Dim WhereFields As Map
    WhereFields.Initialize
    WhereFields.Put("veld", Null)
            
    DBUtils.UpdateRecord(Main.SQL1,  Main.DBTableName3, "veld","something", WhereFields)

I added a field named"veld" in a sqlite database with ExecNonQuery . I want to fill the field with "something". The new field howe ever is filled with NULL. How can I find this field with wherefields when it is not filled and is NULL?
 

Mahares

Expert
Licensed User
Longtime User
I want to fill the field with "something". The new field howe ever is filled with NULL.
I don't use DBUtils much, but here is a way to do it the conventional way:
B4X:
Dim strQuery As String = $"UPDATE ${Main.DBTableName3} SET veld = ? WHERE veld is null"$
    Main.SQL1.ExecNonQuery2(strQuery, Array As String( "Something"))
 
Upvote 1
Top