[Gambas-user] Password problem in database connection

Tobias Boege taboege at gmail.com
Fri Jan 5 01:50:58 CET 2018


On Fri, 05 Jan 2018, Doug Hutcheson wrote:
> That is sound advice, Tobi. I was expecting to be able to use the IDE
> Connection tool because it was there and I assumed it was the correct
> way to go.   "8-)
> 
> I will now examine the Connection object and see if it allows me to use
> it for data-aware controls - I assume it does.
> 

Ah, I think I understand your recent and current concerns about the
data-aware/-bound controls now.

These controls work when you place them inside a DataSource container
and the DataSource needs a Connection object in its property of the
same name. True to its name, the DataSource container provides its
children with (meta)data from the database and it needs a Connection
to a database to do that. Makes sense, right?

The IDE form editor of course lets you only select Connections it knows
about, in that little Combobox. Since you create the Connection at
runtime now, let it be inside a variable $hConn, you need to set

  DataSource1.Connection = $hConn

at some point in your code and everything will work. Where this line
occurs depends on your program (do you have the Connection ready before
the form containing the data-aware controls is shown or do you establish
it on-demand?).

Note that (IIRC) you can fill/change the DataSource.Connection at any
time, so whatever you do should be fine.

I didn't get your problem when you mentioned data-aware controls the
first time because I don't use the form editor all that often anymore,
and as you see, data-aware controls aren't really related otherwise
to defining Connections.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk


More information about the User mailing list