Android Question field name into B4XTable

giannimaione

Well-Known Member
Licensed User
Longtime User
Hi,
in some posts and examples there is a follow example:

B4X:
tbl.sql1.ExecNonQuery2("DELETE FROM data WHERE rowid = ?", Array (RowId))

my app make column with:
B4X:
Dim a1 As B4XTableColumn = tbl.AddColumn("id", tbl.COLUMN_TYPE_TEXT)
a1.Width = 20dip

in my app "rowid" not exists, and i use
B4X:
tbl.sql1.ExecNonQuery2("DELETE FROM data WHERE c0 = ?", Array (RowId))
into table "data" there are column named "c0, c1, c2, c3, ......."
how to set column name into table "data" ?
 
Solution
B4X:
tbl.sql1.ExecNonQuery2("DELETE FROM data WHERE rowid = ?", Array (RowId))
(This can't be right, but I could be wrong)


I have added these columns as an example
Add Columns:
Dim id As B4XTableColumn = tbl.AddColumn("id", tbl.COLUMN_TYPE_TEXT) 'equals to c0
Dim column1 As B4XTableColumn = tbl.AddColumn("column1", tbl.COLUMN_TYPE_TEXT) 'equals to c1
Dim column2 As B4XTableColumn = tbl.AddColumn("column2", tbl.COLUMN_TYPE_TEXT) 'equals to c2

'RowId is the identifier of each row, you can think of it as the primary key

Could something use this to delete values from a column
Delete from column 1:
Dim column1 As B4XTableColumn = tbl.AddColumn("column1", tbl.COLUMN_TYPE_TEXT) 'equals to c1   
Dim sqlId As String =    column1.SQLID...

Mariano Ismael Castro

Active Member
Licensed User
B4X:
tbl.sql1.ExecNonQuery2("DELETE FROM data WHERE rowid = ?", Array (RowId))
(This can't be right, but I could be wrong)


I have added these columns as an example
Add Columns:
Dim id As B4XTableColumn = tbl.AddColumn("id", tbl.COLUMN_TYPE_TEXT) 'equals to c0
Dim column1 As B4XTableColumn = tbl.AddColumn("column1", tbl.COLUMN_TYPE_TEXT) 'equals to c1
Dim column2 As B4XTableColumn = tbl.AddColumn("column2", tbl.COLUMN_TYPE_TEXT) 'equals to c2

'RowId is the identifier of each row, you can think of it as the primary key

Could something use this to delete values from a column
Delete from column 1:
Dim column1 As B4XTableColumn = tbl.AddColumn("column1", tbl.COLUMN_TYPE_TEXT) 'equals to c1   
Dim sqlId As String =    column1.SQLID   
tbl.sql1.ExecNonQuery2($"DELETE FROM data WHERE ${sqlId} = ?"$, Array ("value from column 1"))
 
Upvote 1
Solution
Top