B4J Question jRDC2 know affected rows

fhersof

Member
Greetings, Please if you can guide me a little, I am implementing jRDC2 and from an Android mobile I want to know the number of rows affected when sending an update query to the server, thank you very much.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The actual details depend on the db engine you are using.

If you are using MySQL for example then you can do something like:
B4X:
'jRDC2 server RDCHandler
con.BeginTransaction
        Dim Total As Int
        For Each cmd As DBCommand In commands
            con.ExecNonQuery2(Main.rdcConnector1.GetCommand(cmd.Name), _
                cmd.Parameters)
            Total = Total + con.ExecQuerySingleResult("SELECT row_count()")
        Next
        res.Rows.Add(Array As Object(0))
         res.Columns.Put("AffectedRows", Total)
        con.TransactionSuccessful
 
Upvote 0

fhersof

Member
The actual details depend on the db engine you are using.

If you are using MySQL for example then you can do something like:
B4X:
'jRDC2 server RDCHandler
con.BeginTransaction
        Dim Total As Int
        For Each cmd As DBCommand In commands
            con.ExecNonQuery2(Main.rdcConnector1.GetCommand(cmd.Name), _
                cmd.Parameters)
            Total = Total + con.ExecQuerySingleResult("SELECT row_count()")
        Next
        res.Rows.Add(Array As Object(0))
         res.Columns.Put("AffectedRows", Total)
        con.TransactionSuccessful
It is precisely what I needed and it works perfectly, thank you very much Erel
 
Upvote 0
Top