[Gambas-user] gb.db.form driver missing

Michael mdavies5 at ...169...
Thu Feb 17 01:46:41 CET 2011


Tobias,
I am presuming this form is your startup class, in which case you are 
trying to utilise the Db Connector before your resources are fully 
loaded. It might not happen if you use this code in a form lower in the 
hierarchy.
Personally I keep all Db access in a separate class called "data" which 
handles all communication with the database. I then start my apps with a 
"Main" module not a form. The Main module will load resources (such as 
Db Connector), test the Db connection, check password etc, and only then 
load the first form in the hierarchy.
Hope this helps.

Again, a personal preference, but my top level form is always just to 
hold a menu and a status bar. Any actions are being handled by creating 
sub-forms for each menu. This pretty well ensures that the main form is 
loaded before any errors are generated and it gives you a template to 
create a main menu form for any future projects.

Regards
Michael


On 17/02/11 07:43, tobias wrote:
> good evening,
> i'm testing gb.db.form for some time now and got some confusing (in fact
> it is not that confusing, i can imagine the situation): i have a simple
> form form->datasource->databrowser
> and my code is as follows:
>
> PUBLIC hConn AS NEW Connection
>
> PUBLIC SUB Form_Open()
>
> hConn.Type = ...
> hConn.Name = ...
> hConn.Host = ...
> hConn.Open()
>
> END
>
> and this results in an error "driver missing" even before Form_Open() is
> raised, right? if i change the code to initialize the connection in
> Form_Open() everything works... i don't know if it is much trouble to
> change this behavior and i don't think it is neccessary but i haven't
> found anything about this. i think to make a notice or something in the
> Database example would save people some time of figuring this out?
>
> regards,
> tobi
>
> ------------------------------------------------------------------------------
> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
> Pinpoint memory and threading errors before they happen.
> Find and fix more than 250 security defects in the development cycle.
> Locate bottlenecks in serial and parallel code that limit performance.
> http://p.sf.net/sfu/intel-dev2devfeb
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
>




More information about the User mailing list