[Gambas-user] bound controls

Ron Onstenk ronstk at ...239...
Fri Jun 16 00:50:04 CEST 2006


On Thursday 15 June 2006 14:14, jose lucero wrote:
> Hi,
> Could someone how bound controls work.
> I cant seem to find any properties for linking a connection or database to 
> bound controls.
> i opened the database example in 1.9.32 it works fine, but I still cant find 
> where the data controls are linked to the database
> 
> 

When I do it understand it right, when using the gb.db.form components
the first made connection to a database engine will be picked up by 
the gambas runtime as datasource connection.

The gb.db provides the static DB object that give you the user interface.

Open as project the gb.db.form.
In Module Main, the one that start the project you can find the
connection  parameters, now .type=mysql and database .name=test are used.

-------------
PRIVATE $hConn AS NEW Connection

PUBLIC SUB Main()

  $hConn.Type = "mysql"
  '$hConn.User = "root"
  $hConn.Name = "test"
  '$hConn.Host = "/home/benoit"

  'DB.Debug = TRUE

  FMain.Show

END
-------------


Place in your own project the same module (Main) to start with.
Edit the .type and .name as you do need.

Of course the 'FMain.Show' should be your main form.

The main link from user view is the DataSource container control.
All the other controls must placed inside the DataSource container.
They are then bound to where DataSource.Table is pointing to.

The DataCombo has his own property .Table and .Field but uses the same connection.

The DataBrowser has a property .Columns, here you need the field names as in the table.


But for me it was also a puzzle and I stopped to use it.
Main reason the data is comming from several different databases.
and the field source for the DataCombo and other controls are not 
sufficient for me to handle large tables.

I can't use: 
SELECT `member_postal_address` AS Address 
FROM `fantasy_table` 
WHERE `enabled`=true
ORDER BY `member_postal_address`,`TimeStamp` DESC 
LIMIT 10"

to get only the last 10 valid entered records for a DataCombo i.e.
This must be done on client side in the gambas program.
Reading 10000 records, check timestamp is valid, add to array and when done
sorting the array (this goes quick)

regards,

Ron

 




More information about the User mailing list