Multiple connections
-
I have made a SnippetDB application like CodeLib Access version that fish made it http://myweb.hinet.net/home4/s630417/ My problem is i want to use multiple access databases and I don not know how to store my connections or how to use it or simple how to start For only one db is easy and my app is working but i can not figure how to do it for more. Creating a db programaticly is not hard so pls help me with code if possible thx... (o)(o)
-
I have made a SnippetDB application like CodeLib Access version that fish made it http://myweb.hinet.net/home4/s630417/ My problem is i want to use multiple access databases and I don not know how to store my connections or how to use it or simple how to start For only one db is easy and my app is working but i can not figure how to do it for more. Creating a db programaticly is not hard so pls help me with code if possible thx... (o)(o)
I might be missing something here, but have you tried making each connection its own object? Instantiating several database connections as their own objects is the way that I get to multiple database connections. I apologize if I am missing something and this is a stupid answer. Bob Robey
-
I have made a SnippetDB application like CodeLib Access version that fish made it http://myweb.hinet.net/home4/s630417/ My problem is i want to use multiple access databases and I don not know how to store my connections or how to use it or simple how to start For only one db is easy and my app is working but i can not figure how to do it for more. Creating a db programaticly is not hard so pls help me with code if possible thx... (o)(o)
Just store the different connection strings, and create a connection every time you need it. .NET connection pooling will find out if there's already another "closed" open connection (when you close it, it's not actually closed until some time later) and reuse it. The connection string must be identical for a connection to be reused, but if you have 5 different databases, you'll have 5 pools. -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
-
Just store the different connection strings, and create a connection every time you need it. .NET connection pooling will find out if there's already another "closed" open connection (when you close it, it's not actually closed until some time later) and reuse it. The connection string must be identical for a connection to be reused, but if you have 5 different databases, you'll have 5 pools. -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
"connection string must be identical for a connection to be reused" Eaven the db names should be the same? The thing is that I have a app with a TreeView and the treeview is populated with all db names and then in each db node with some info from the db, and when i click a node the app will use to get info from the selected db... Until now this is the method I have used changein the string but when I create a new DB and try to insert it in the tre view i do the .clear() thing from the tree and the try to rebuild it again... and some errors apear i will be back with code and error text... Sorry for my BAD BAD english... Thx
-
"connection string must be identical for a connection to be reused" Eaven the db names should be the same? The thing is that I have a app with a TreeView and the treeview is populated with all db names and then in each db node with some info from the db, and when i click a node the app will use to get info from the selected db... Until now this is the method I have used changein the string but when I create a new DB and try to insert it in the tre view i do the .clear() thing from the tree and the try to rebuild it again... and some errors apear i will be back with code and error text... Sorry for my BAD BAD english... Thx
Well, then just make sure that everytime the same node is selected, the same connection string is built. You'll have connection pooling working for each different connection string, but in you scenario, I think that's the best you can do. -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!