Hi everyone
after TransactionSuccessful every thing is ok but when reopen app i see data the same before update
after TransactionSuccessful every thing is ok but when reopen app i see data the same before update
B4X:
Main.SQL1.BeginTransaction
Try
If mapslcted.Size=0 Then Return
Dim RowIndexs As Int =GetRowCount(MasterKeyScreen)
Dim multiple_columns As String
Dim SQLX As String
For i = 0 To mapslcted.Size - 1
LogColor("Key: " & mapslcted.GetKeyAt(i),Colors.Blue)
Dim Key As String=mapslcted.GetKeyAt(i)
SQLX=$"select * from Tab_OrderDetail where GenCode='${Key}'"$
Dim rsComb As ResultSet
rsComb=Main.SQL1.ExecQuery(SQLX)
Do While rsComb.NextRow
RowIndexs=RowIndexs+1
Main.SQL1.ExecNonQuery2("INSERT INTO Tab_OrderDetail ('OrderID','Line_NO','menuitemID','Price','Quantity','Total','GenCode') values(?,?,?,?,?,?,?)", Array As Object (MasterOrderIDScreen,RowIndexs,rsComb.GetString("menuitemID"),rsComb.GetString("Price"),rsComb.GetString("Quantity"),rsComb.GetString("Total"), MasterKeyScreen ))
Loop
rsComb.Close
Next
'
SQLX=$"select Total from Tab_OrderDetail where GenCode='${MasterKeyScreen}'"$
Dim rs As ResultSet
rs=Main.SQL1.ExecQuery(SQLX)
Dim Tax As Double
Dim SRV As Double
Dim subtot As Double
Do While rs.NextRow
subtot=subtot+ rs.GetString("Total")
Loop
Dim amt As Double
SRV=(subtot*Main.ServiceFeesAMT)/100
Tax=(SRV+subtot)*(Main.SalesTax)/100
amt=Round2(amt+subtot+SRV+Tax,2)
Main.SQL1.ExecNonQuery("update Tab_Orders SET OrderValue =OrderValue +'"& amt &"',Tax=Tax+'"& Tax &"',ServiceCharge=ServiceCharge+'"& SRV &"' where GenCode='"& MasterKeyScreen &"' " )
multiple_columns=""
For i = 0 To mapslcted.Size - 1
Dim Key As String=mapslcted.GetKeyAt(i)
multiple_columns=multiple_columns & "or GenCode=" & "'"& Key &"'"
Next
multiple_columns=multiple_columns.SubString(2)
Main.SQL1.ExecNonQuery ("delete from Tab_Orders where "& multiple_columns &" ")
Main.SQL1.TransactionSuccessful