cmd.ExecuteTable("table1",500) error

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 i = 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. :)
 

giannimaione

Well-Known Member
Licensed User
This is my little help
B4X:
Form1.Show
[COLOR="Red"]AddTable ("Form1", "TableView", 30, 30, 200, 200)[/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
 

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).
 

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.
 
Top