We have a B4XTable that on Table_CellClick presents a ChoiceBox.
On Making a selection the Cell is updated and the internal Data DB is Updated.
I have tried to tidy the Query using Smart String Literals which then Errors out .. stating "there is no Column Named " the ChoiceBox Selection Value"
The query Syntax appears correct , Can someone point out what I am doing wrong.
On Making a selection the Cell is updated and the internal Data DB is Updated.
I have tried to tidy the Query using Smart String Literals which then Errors out .. stating "there is no Column Named " the ChoiceBox Selection Value"
The query Syntax appears correct , Can someone point out what I am doing wrong.
B4X:
Sub B4XTableM_CellClicked (ColumnId As String, RowId As Long)
Dim column As B4XTableColumn = B4XTableM.GetColumn(ColumnId)
Dim value As String = B4XTableM.GetRow(RowId).Get(ColumnId)
Dim visibleRowID As Int = (B4XTableM.VisibleRowIds.IndexOf(RowId))
'Global Vars
ClickedRow=RowId
ClickedCol=column.SQLID
'...... more code
Sub cBox_SelectedIndexChanged(Index As Int, Value As Object)
'Value = "Weekly" !!!!
'OK Working
'B4XTableM.sql1.ExecNonQuery2($"UPDATE data SET ${ClickedCol} = ? WHERE rowid = ?"$, Array As String(Value, ClickedRow))
'OK Working
'Dim myquery As String = $"UPDATE data SET ${ClickedCol} = ? WHERE rowid = ?"$
'B4XTableM.sql1.ExecNonQuery2(myquery, Array As String (Value, ClickedRow))
'OK Woking
'Dim myquery As String = "UPDATE data SET " & ClickedCol & " = '" & Value & "' WHERE rowid = " & ClickedRow
'B4XTableM.sql1.ExecNonQuery(myquery)
'ERROR !!!
java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (no such column: Weekly) !!! Weekly , OR whatever Item is Choosen from ChoiceBox
Dim myquery As String = $"UPDATE data SET ${ClickedCol} = ${Value} WHERE rowid = ${ClickedRow}"$
B4XTableM.sql1.ExecNonQuery(myquery)
B4XTableM.Refresh
End Sub
Many Thanks