Try
Dim RowId As Long = GetRowId(Sender)
Connection.CU=Connection.DB.ExecQuery2("SELECT USERNAME FROM ACCOUNT WHERE rowid=? ",Array As String(RowId) )
Connection.CU.Position=0
Dim name As String=Connection.CU.GetString("USERNAME")
If name= "ADMIN" Then
Msgbox("You can not delete this account.","ADMIN ACCOUNT")
Return
Else
Dim Item As Map = B4XTable1.GetRow(RowId)
Dim sf As Object = xui.Msgbox2Async($"Delete Account: ${Item.Get("USERNAME")}?"$, "", "Yes", "", "No", Null)
Wait For (sf) Msgbox_Result (Result As Int)
If Result = xui.DialogResponse_Positive Then
B4XTable1.sql1.ExecNonQuery2("DELETE FROM data WHERE rowid = ?", Array(RowId))
Connection.DB.ExecNonQuery2("DELETE FROM ACCOUNT WHERE rowid = ?", Array(RowId))
Connection.DB.ExecNonQuery2("DELETE FROM USER WHERE rowid = ?", Array(RowId))
B4XTable1.ClearDataView 'update the table
End If
End If
Catch
Msgbox(LastException.Message, "Error")
End Try