Sub DeleteRow2 (tbl As B4XTable, RowId As Long, DBRowId As Long)
SQL1.ExecNonQuery2("DELETE FROM GroceProd WHERE gid = ?", Array (DBRowId))
tbl.sql1.ExecNonQuery2("DELETE FROM data WHERE rowid = ?", Array (RowId))
Dim page As Int = tbl.CurrentPage
Dim FirstIndex As Int = tbl.FirstRowIndex
tbl.ClearDataView
If FirstIndex + 1 >= tbl.mCurrentCount Then
page = page - 1
End If
tbl.CurrentPage = page
End Sub
Sub B4XTable2_CellLongClicked (ColumnId As String, RowId As Long)
Dim sf As Object = XUI.Msgbox2Async("Are you sure you want to delete this row?", "Deleting a row from your data!", "Yes", "", "No", Null)
Wait For (sf) Msgbox_Result (Result As Int)
If Result = XUI.DialogResponse_Positive Then
DeleteRow2(B4XTable2, RowId, RowId)
End If
Dim Data1 As List
Data1.Initialize
Dim Rs As ResultSet = SQL1.ExecQuery("SELECT gid, gprod, gprice FROM GroceProd")
Do While Rs.NextRow
Dim Row(3) As Object
Row(0) = Rs.GetInt("gid")
Row(1) = Rs.GetString("gprod")
Row(2) = Rs.GetString("gprice")
Data1.Add(Row)
Loop
B4XTable2.SetData(Data1)
Rs.Close
End Sub