I have the following method obtained and modified from a very old post on the forum which adds a column to a db table to an already existing table. I use this same function for desktop and iOS, but I am getting a crash on Android. The error is “Column ColumnName does not exist”
CreateColumn(DB As SQLiteDatabase, tableName As String, mName As String, mType as String) As Boolean
// Check Column Schema to see if Column exists
Dim rs as RowSet
Dim COLExists As Boolean
Dim COLCreated As Boolean
rs = theDB.TableColumns(tableName)
If rs <> nil then
While Not rs.AfterLastRow
If rs.Column("ColumnName").StringValue = mName then 'XX crashes here
COLExists = True
End If
rs.MoveToNextRow
Wend
End If
// Create column if it doesn't exist
If NOT COLExists Then
theDB.ExecuteSQL("ALTER TABLE " + tableName + " ADD COLUMN " + mName + " " + mType)
COLExists = True
COLCreated = True
Else
COLCreated = False
End If
Return ColCreated
The above is called in another method to see if the db is newer:
dim chkCol as Boolean
chkCol = CreateColumns(myDB, "myTableName", "MyNewColumnToAdd", "TEXT")
Any idea as to why this would not work on Android?