Android Question [SOLVED] SQL Result

makis_best

Well-Known Member
Licensed User
Longtime User
If I execute one SQL statement like
Code: Copy
SQL1 = $"DELETE FROM LOCAL_Trade WHERE Code = '${OrdersTable.GetValue(1, RowX)}'"$
No mater if the condition apply or not the command it will executed and it will complete successfully and the result will be true.

How I can know that delete actually is made.

Thank you.
 
If I execute one SQL statement like
Code: Copy
SQL1 = $"DELETE FROM LOCAL_Trade WHERE Code = '${OrdersTable.GetValue(1, RowX)}'"$
No mater if the condition apply or not the command it will executed and it will complete successfully and the result will be true.

How I can know that delete actually is made.

Thank you.

Code: Copy
Sub GetNumberOfChanges() As Long
 Dim strSQL As String
 Dim lRows As String
 strSQL = "SELECT changes()"
 lRows = SQL1.ExecQuerySingleResult(strSQL)
 Return lRows
End Sub


RBS
 
Upvote 0
if it fails via try catch
Code: Copy
SQL1.BeginTransaction
Try
  'block of statements like:
  For i = 1 to 1000
    SQL1.ExecNonQuery("INSERT INTO table1 VALUES(...)
  Next
  SQL1.TransactionSuccessful
Catch
  Log(LastException.Message) 'no changes will be made
End Try
SQL1.EndTransaction
https://www.b4x.com/android/help/sql.html#sql_begintransaction
 
Upvote 0

Similar Threads

Replies
0
Views
4K
  • Locked
  • Article Article
Android Tutorial [B4X] SQL with Wait For
Replies
16
Views
42K
  • Locked
  • Article Article
Android Tutorial SQL tutorial
Replies
161
Views
337K
Back
Top