cmd.ExecuteTable("table1",500) error

Discussion in 'Questions (Windows Mobile)' started by dennishea, Jun 15, 2008.

  1. dennishea

    dennishea Active Member Licensed User

    When I insert this into the program it kicks out this error

    error description:
    arithmetic operation resulted in an overflow

    This is it's environment.

    PHP:
    Sub App_Start
       Form1
    .Show
       Con
    .New1   
        Cmd
    .New1("",con.Value)
        
    Con.Open("Data Source = " AppPath "\Northwind.sl3")    
        
    cmd.CommandText="CREATE TABLE if not exists table1 (col1,col2)"
        
    cmd.ExecuteNonQuery
        cmd
    .AddParameter("value1")
        
    cmd.AddParameter("value2")   
        
    cmd.CommandText "INSERT INTO [table1] (col1,col2) VALUES (@value1,@value2)"
        
    Con.BeginTransaction
        cmd
    .SetParameter("value2","SomeValue")
        For 
    0 To 10
            cmd
    .SetParameter("value1",i)
            
    cmd.ExecuteNonQuery
        Next
       cmd
    .ExecuteTable("table1",500)
        
    Con.EndTransaction
        Con
    .Close
        cmd
    .Dispose
        Con
    .Dispose
    End Sub
    Any help appreciated. :)
     
  2. giannimaione

    giannimaione Well-Known Member Licensed User

    This is my little help
    Code:
    Form1.Show
    [COLOR=
    "Red"]AddTable ("Form1""TableView"3030200200)[/COLOR]
    Con.New1    
    Cmd.New1(
    "",con.Value)
    Con.Open(
    "Data Source = " & AppPath & "\Northwind.sl3")    
    cmd.CommandText=
    "CREATE TABLE if not exists table1 (col1,col2)"
    cmd.ExecuteNonQuery
    cmd.AddParameter(
    "value1")
    cmd.AddParameter(
    "value2")    
    cmd.CommandText = 
    "INSERT INTO [table1] (col1,col2) VALUES (@value1,@value2)"
    Con.BeginTransaction
    cmd.SetParameter(
    "value2","SomeValue")
    For i = 0 To 10
          cmd.SetParameter(
    "value1",i)
          cmd.ExecuteNonQuery
    Next
    Con.EndTransaction
    [COLOR=
    "Red"]cmd.CommandText="select * from table1"
    cmd.ExecuteTable(
    "TableView",0)
    [/COLOR]Con.Close
    cmd.Dispose
    Con.Dispose
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    Small explanation:
    ExecuteTable executes the command's query and puts the result in a table control.
    The two arguments that it receives are the name of the table control and maximum rows to return (or 0 to return all rows).
     
  4. dennishea

    dennishea Active Member Licensed User

    Hi Gianni Maione

    First thanks for your help. I added your changes and that got rid of errors but I was still coming up with a blank table. It then struck me that addtable was buried under the one I already had. When I made mine invisible all was well. My only remaining question is I created mine at design time and it still isn't showing data and yours being added at run time is. What am I missing for design time to work and what is the difference between the two? Thanks again for your help.
     
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