[Gambas-user] DataComboView: reading rows and columns

Gianluigi bagonergi at gmail.com
Fri Jan 29 18:37:03 CET 2021


Il giorno ven 29 gen 2021 alle ore 17:25 Detlef Eberhardt <
detlef.eberhardt at gmail.com> ha scritto:

> Hi Gambas community,
>
> this is my very first post in a mailinglist, so please point me into the
> right direction if I miss something.
>
> I just started this week with a Gambas GUI-frontend of a Lens-Register
> database. It's great fun to work with Gambas as it is IMHO more
> comfortable than any other VB*A or whatever. I have got some issues
> with the DataComboView controls as I cannot find any further help or code
> snippets on the internet. The DataComboView is bound to a table in
> sqlite3 (with PK) and shows 2 columns. How can I read the first and
> second column (and row) out of the DataComboView control?
>
> Cheers
> 01McAc
>
>
Hi,

I use the valuebox type Date. 👍
Assuming you have created the table like this ($hConn is the connection to
your sqlite3 database):

  hTable = $hConn.Tables.Add("table-name")
  hTable.Fields.Add("takey", db.Serial)
  hTable.Fields.Add("tadat", db.Date)
  hTable.PrimaryKey = ["takey"]
  hTable.Update

and that you populated it like this:

  Dim hResult As Result

  hResult = $hConn.Create("table-name")
  hResult!tadat = Date(ValueBox1.Value)
  hResult.Update

So to display the date with Key = 3 in ValueBox2 you will do:

  Dim hResult As Result

  hResult = $hConn.Find("table-name", "takey = &1", 3)
  If hResult.Available Then
    hResult.MoveFirst
    ValueBox2.Value = hResult!tadat
  Endif

For more information about the dates:
http://gambaswiki.org/wiki/doc/date

Regards
Gianluigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210129/c19aa43b/attachment-0001.htm>


More information about the User mailing list