M
Marco Liedekerken
Hi,
Are there some "Good practices" in how to use a SqlConnection object in a
windows application?
Because I always use the same DB I don't want to give the SqlConnection
object as a parameter to all of my methods who use the SqlConnection. I want
it to be like a global variable to my whole application so I can use it
everywhere without thinking about it! Is this possible in a nice OO way
(with use of multiple threads, DataReaders, DataAdapters and still good
performance)?
Is it better to keep the SqlConnection open all the time? Opening and
Closing the connection 1000 times is not ideal!
This SqlConnection always points to the same database (an xml settingsfile
has a string which points to this DB) in all the application code.
Hope someone can help me, Marco
Are there some "Good practices" in how to use a SqlConnection object in a
windows application?
Because I always use the same DB I don't want to give the SqlConnection
object as a parameter to all of my methods who use the SqlConnection. I want
it to be like a global variable to my whole application so I can use it
everywhere without thinking about it! Is this possible in a nice OO way
(with use of multiple threads, DataReaders, DataAdapters and still good
performance)?
Is it better to keep the SqlConnection open all the time? Opening and
Closing the connection 1000 times is not ideal!
This SqlConnection always points to the same database (an xml settingsfile
has a string which points to this DB) in all the application code.
Hope someone can help me, Marco