After updating a record in an sqlite database based on values from an custom input form I like to update a B4XTable that shows the list of the records of the databasetable.
Database Update is working perfect but updating the B4XTable causes an java error as shown in the attached screenshot. As you see I retrive the column names direct from the B4XTable Object to build the SQL Command. If I try to run the code the error says that the column is unknown. Retriving direct is neccessary because table column (header) names a varying due to different languages settings. In addition I used the column names of the underlying database table column but this is causing the same error.
It is mysterious for me that the retrieved columns are not nown by the query. Is there a difference I do not know? Up to now I understood that the column names of the virtual database table of the B4XTable are automatic constructed out of the column(header) names given in the AddColumn statement building the B4Xtable.
Whats going wrong here?
updateTableRow:
Sub updateTableRow()
Try
Dim co As B4XTableColumn
Dim cn As String
Dim sqlstring As String = "UPDATE data Set "
For x = 0 To B4XTable1.Columns.Size-1
co = B4XTable1.Columns.Get(x)
cn = co.Title
If cn <> "rowid" Then
sqlstring=sqlstring & cn & "=?,"
End If
Next
sqlstring = sqlstring.SubString2(0,sqlstring.Length-1)
sqlstring = sqlstring & " WHERE rowid = " & currB4XTableROWID
B4XTable1.sql1.ExecNonQuery2(sqlstring, Array As String( _
Parameter_Bezeichnung.Text, _
Parameter_Text1.Text, _
Parameter_Text2.Text, _
Parameter_Ganzzahl.Text, _
Parameter_Dezimal.Text, _
Parameter_Bemerkung.Text))
Catch
Log(LastException)
End Try
End Sub
Database Update is working perfect but updating the B4XTable causes an java error as shown in the attached screenshot. As you see I retrive the column names direct from the B4XTable Object to build the SQL Command. If I try to run the code the error says that the column is unknown. Retriving direct is neccessary because table column (header) names a varying due to different languages settings. In addition I used the column names of the underlying database table column but this is causing the same error.
It is mysterious for me that the retrieved columns are not nown by the query. Is there a difference I do not know? Up to now I understood that the column names of the virtual database table of the B4XTable are automatic constructed out of the column(header) names given in the AddColumn statement building the B4Xtable.
Whats going wrong here?