[Gambas-user] Managing relationship one to many

francesco.difusco@libero.it francesco.difusco at ...69...
Mon Sep 6 15:39:19 CEST 2004


I have solved the problem. When I managed the tableview_data event, I uses the
same array name to indicate the fields to display in the tableview control, even
if I deleted it before initializing it, in the procedure I used to display
records, like this:

SUB display_riviste(tbv AS tableview, testata AS String)
DIM sql AS String
DIM nRecord AS Integer
sql="SELECT IdRivista, Inventario, IdEditore, Numero, Mese, Anno, Tomo, Volume,
Pagine from riviste where IdTestata="& testata
query_riviste=hConnection.Exec(sql)
nRecord=query_riviste.count
WITH query_riviste
'tbv.Rows.Count
 tbv.rows.count=0
 IF .count<>0 THEN
    tbv.columns.count=.fields.count
 tbv.rows.count=nRecord
    END IF
 END WITH
campiriviste.clear
campiriviste.add("IdRivista")
campiriviste.add("Inventario")
campiriviste.add("IdEditore")
campiriviste.add("Numero")
campiriviste.add("Mese")
campiriviste.add("Anno")
campiriviste.add("Tomo")
campiriviste.add("Volume")
campiriviste.add("Pagine")
END

TO solve the problem I had to use two arrays, one for each form, the one called
"campiriviste", and the other called "campitestate". Before this I used only the
array "campi". In my intentions, this array should have been cleared whenever I
switched to other form, but when forms were overlapped, the two tableview (one
per form) controls raised  the  tableview_data event, each one using the same
array, "campi"  common to the two forms.

Well, now it is clear to me.


Francesco






More information about the User mailing list