[Gambas-user] How do I use the same connection to a database

Benoit Minisini gambas at ...1...
Sat Sep 4 12:58:54 CEST 2004


On Saturday 04 September 2004 12:29, francesco.difusco at ...69... wrote:
> Hi,
>
> I would like to know how to use the same connection to a mysql database
> between various forms. I create the connection to my database in main form,
> and then, I need to open various tables in different forms. If I declare a
> variable hConnection iof connection type in my main form, as public, I am
> non able to use it in other forms. I have tried to declare it as Public
> Static, but it is the same. Should I declare it in a module?
>
> Thanks
>
> Francesco Di Fusco
>
>

PUBLIC STATIC is the solution. I think you forgot that *THERE IS NO GLOBAL 
VARIABLE* in Gambas, so mut reference your connection variable from a form 
reference: MyForm.MyConnection

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list