Try
Dim RowId As Long = GetRowId(Sender)
Log("RowId: " + Rowid)
Connection.CU=Connection.DB.ExecQuery2("SELECT USERNAME FROM ACCOUNT WHERE rowid=? ",Array As String(RowId) )
if Connectioin.CU.Rowcount > 0 then
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
End If
Catch
Msgbox(LastException.Message, "Error")
End Try
Code:
Try
Dim RowId As Long = GetRowId(Sender)
Log("RowId: " + Rowid)
Connection.CU=Connection.DB.ExecQuery2("SELECT USERNAME FROM ACCOUNT WHERE rowid=? ",Array As String(RowId) )
if Connectioin.CU.Rowcount > 0 then
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
End If
Catch
Msgbox(LastException.Message, "Error")
End Try
i meant, after trying your code, the if Highlighted, executes fine but the else highlighted does not execute at all, the log shows the RowId value according to its row in the table.