[Gambas-user] Database example
Charlie Reinl
Karl.Reinl at ...9...
Sun Jun 14 18:55:26 CEST 2009
Am Sonntag, den 14.06.2009, 05:57 -0700 schrieb charlesg:
> Hi,
>
> I have extracted what I need from the database example. I can even get it to
> do exactly what I want. But, in truth, I do not understand how it works
> exactly.
> '===================================================
> ' FMain.class
> PUBLIC $hConnLocl AS NEW Connection
> PUBLIC $resData AS Result
> '--------------------------------------------------------
> PUBLIC SUB Form_Open()
> WITH $hConnLocl
> .type = "sqlite3"
> .Name = "/home/charles/sqlite3/locl.sqlite"
> END WITH
> $hConnLocl.Open()
> $resData = $hConnLocl.Exec("select * from hist")
> END
> '---------------------------------------------------------
> PUBLIC SUB btnRun_Click()
> DIM hForm AS FRequest
>
> hForm = NEW FRequest($hConnLocl, $resData)
> hForm.show
> END
> '===================================================
> ' FRequest.class
> PRIVATE $hConnlocl AS Connection
> PRIVATE $rData AS Result
> '---------------------------------------------------------
> PUBLIC SUB _new(hConnlocl AS Connection, rData AS Result)
> DIM hField AS ResultField
> DIM iInd AS Integer
>
> $hConnlocl = hConnlocl
> $rData = rData
> tbvData.Rows.count = 0
> tbvData.Columns.count = $rData.Fields.Count
>
> FOR EACH hField IN $rData.Fields
> WITH hField
> tbvData.Columns[iInd].text = .Name
> tbvData.Columns[iInd].width = 60
> END WITH
> INC iInd
> NEXT
> tbvData.Rows.Count = $rData.Count
> END
> '---------------------------------------------------------
> PUBLIC SUB tbvData_Data(Row AS Integer, Column AS Integer)
> $rData.MoveTo(row)
> tbvData.Data.text = Str($rData[tbvData.Columns[column].text])
> END
> '===================================================
>
> My lack of understanding hinges around:
> 1. hForm = NEW FRequest($hConnLocl, $resData)
> 2. $hConnlocl = hConnlocl
> $rData = rData
> 3. The help says _data is called when the tableview 'needs data'. At what
> point in the code does it need this data?
>
> Any fog elimination welcomed.
>
> rgds
>
Salut Charles,
no fog here, but have you ever tried in the IDE whats you can find
behind /Project/Version/Source Archiv ?
I tell you more a shortcut Ctrl+Alt+A makes the same.
The so made archiv, you can attach to your mail, even the locl.sqlite
DataBase , and then if you tell us witch gambas Version you use, may be
one of that guys on the list will have a look.
But if you have to copy out the Code from a mail, split it into its
parts, by creating all the FORMs and Modules, then create the componets
needed on the Form/Forms having not the origin
Database ....pfffffffffffffffffff, will see perhaps tomorrow.
Never the less
--
Amicalment
Charlie
More information about the User
mailing list