Android Question executeUpdate method must not return a result set

Frank Cazabon

Member
Licensed User
Longtime User
I am uploading data from an SQLite database on a tablet to an SQL Server database on the LAN using DBRequestManager.

I have set query in the config.properties like this:

sql.insert_deliveryhistory=INSERT INTO [DeliveryHistory] ([del_pk],[del_rndfk],[del_time],[del_dspfk],[del_receivedby],[del_delivered],[del_scancode]) VALUES (?, ? , ?, ?, ?, ?, ?)


This is my code:

B4X:
        Dim deliveries As List
        deliveries = DBUtils.ExecuteMemoryTable(SQLLite, "SELECT [del_pk],[del_rndfk],[del_time],[del_dspfk],[del_receivedby],[del_delivered],[del_scancode] FROM DeliveryHistory", Null, 0)

        Dim commands As List
        commands.Initialize
       
        For i = 0 To deliveries.Size - 1
           
            Dim cmd As DBCommand
            cmd.Initialize
            cmd.Name = "insert_deliveryhistory"
            cmd.Name = "select_runsheetdetails"

            Dim delivery() As String
            delivery = deliveries.Get(i)

            cmd.Parameters = Array As Object(delivery(0), delivery(1), delivery(2), delivery(3), delivery(4), delivery(5), delivery(6))
'            cmd.Parameters = Array As Object(delivery)
            commands.Add(cmd)
           
        Next
       
        reqManager.ExecuteBatch(commands, "Upload")

When the code runs I get an error in my JobDone code:

java.sql.SQLException: The executeUpdate method must not return a result set.

Can anyone point out what I am doing wrong, please?
 

Frank Cazabon

Member
Licensed User
Longtime User
I found 2 problems. The major one being that I did a copy and paste and didn't delete a line that I should have, so I had these lines:

B4X:
            cmd.Name = "insert_deliveryhistory"
            cmd.Name = "select_runsheetdetails"

Whereas I should have only had the first line, the second should have been deleted.

The second problem was that I was storing a date time value as a string in the SQLite database and that was not being interpreted correctly when being inserted in SQL Server. I had to change the format from this: 20140714135936 to this: 20140714 13:59:36
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…