Android Question ExecuteBatch how to use

Discussion in 'Android Questions' started by Tom1s, May 28, 2015.

  1. Tom1s

    Tom1s Member Licensed User

    Hi

    I would like to upload all the rows from the sqllite table to the server.
    I think it would be best to use execute batch but I can't figure out the way to do it.

    If cmd name is "i" & i ' should I put RDC config file the same
    sql.?i=INSERT INTO table 1 (col1,col2) VALUES (?,?) ?

    Code:
    Dim i As Int
    Dim commands As List
    commands.Initialize
    CursorLog = SQL1.ExecQuery(
    "Select col1,col2 from Table1")

    For i = 0 To CursorLog.RowCount - 1
    CursorLog.Position = i
    Dim cmd As DBCommand
    cmd.Initialize
    cmd.Name =  
    "i" & i '"add_logs"

    ????
    commands.Add(cmd)

    Next
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You should define an insert command in the config file.

    Then do something like:
    Code:
    Dim commands As List
    commands.Initialize
    For i = 0 To CursorLog.RowCount - 1
     CursorLog.Position = i
     
    Dim cmd As DBCommand
     cmd.Initialize
     cmd.Name = 
    "InsertCommand"
     cmd.Parameters = 
    Array(CursorLog.GetString("col1"), CursorLog.GetString("col2"))
     commands.Add(cmd)
    Next
    reqManager.ExecuteBatch(commands, 
    null)
     
    Tom1s and Harris like this.
  3. Tom1s

    Tom1s Member Licensed User

    This was just what i needed, thanks!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice