Hi,
You can keep the instance as a static member of some class.
Or even better, you could use a similar approach but do not make public the
connection, instead make public the methods (ExecuteScalar,
ExecuteReader,etc ) that access the data, these method will all share the
connection internally. This will allow you to make sure that the connection
is always closed as soon as you finish with it. ( Except in the case of
ExecuteReader where the connection is open while the reader is open)
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Tony Johansson" <jo*****************@telia.com> wrote in message
news:lx*********************@newsc.telia.net...
Hello!
We have a database and several forms that access the database. When we
access the database from all the different forms we only want to have one
OleDbConnection that all the forms use. I assume that must be possible
because creating a OleDbConnection for each form takes a lot of time.
Where would I put this OleDbConnection so all the other forms understand
that a connection exist?
//Tony