[Gambas-user] TableView Data from database

rocko sunblaster5 at ...626...
Thu Sep 27 23:19:36 CEST 2012


I'm using a Table view to view data from an SQLite database.
I would use a dataview but I only need to display some database fields
not all of them.

This is the code I have so far:
Public Sub Form_Open()

Dim sResult As Result
Dim id As Integer

  TableView1.Columns.Count = 3
  TableView1.Rows.Count = 10

  TableView1.Columns[0].Title = ("ID")
  TableView1.Columns[0].Width = (TableView1.Width / 10) * 2
  TableView1.Columns[1].Title = ("Location")
  TableView1.Columns[1].Width = (TableView1.Width / 10) * 4.5
  TableView1.Columns[2].Title = ("Days Left")
  TableView1.Columns[2].Width = (TableView1.Width / 10) * 2

  sResult = DB.Edit("inventory", id = &1, ID)
  sResult!id = ID
  sResult!location = TableView1.Columns[1].
  sResult.Update

I obviously get an error at runtime on the second to last line as I'm
not sure how to put data from the database into the table column.

I believe I asked this question before using a dataview on how to
display only some data from the database as using a dataview would be
easier but I never got a response so I'm trying a table view as it has
more options--at least I think so.

Any help would be appreciated.






More information about the User mailing list