[Gambas-user] DataSource & DataBrowser problem
Benoît Minisini
gambas at ...1...
Mon Feb 6 20:47:14 CET 2012
Le 03/02/2012 20:51, John Rose a écrit :
> I've looked at the Database example and I still don't understand how to
> use the DataSource& DataBrowser controls.
>
> My DataSourceCountry control has its Table property set to country (one
> of the tables in the Test.db SQLite3 database in the Data directory of
> the attached Test project. In the Form_Open procedure, the variable
> DatabaseConnection was previously created successfully (i.e. before I
> added these 2 controls) and database opened OK. In that procedure, the
> Connection property of DataSourceCountry is set to this variable: should
> I do that? My DataBrowserCountry control has Columns set to country
> (which is one of the columns in the country table, though not the
> primary key) and Editable set to True. The project compiles& saves OK.
>
> When I try to run it, a popup comes up either with 'Null object' or
> 'Driver name missing'. Any ideas please.
>
If the DataSource Connection property is not set, then DataSource will
use the default connection object, which is usually the first one
created. In your code, this is the "Private DatabaseConnection As New
Connection", which is not initialized.
So the 'Driver name missing' error, because DataSource tries to open
that connection object during form instanciation, before Form_Open is
called.
Another point: DataSource is a container. Every other control that
depends on it must be put *inside* it.
Regards,
--
Benoît Minisini
More information about the User
mailing list