473,657 Members | 2,394 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Array of db connections with string subscription

Hi

Can I have an array of type OleDb.OleDbConn ection that has strings as
subscription values? The reason I need this is my app reads a configuration
file with db names and their locations and it then creates all connections
and if subscript is the db name as string then it is easy for the app to
figure out which db is which and to link it with other db settings in the
configuration file.

Thanks

Regards
Jan 8 '08 #1
7 1292
"John" <Jo**@nospam.in fovis.co.ukwrot e in
news:#L******** ******@TK2MSFTN GP02.phx.gbl:
Can I have an array of type OleDb.OleDbConn ection that has strings as
subscription values? The reason I need this is my app reads a
configuration file with db names and their locations and it then
creates all connections and if subscript is the db name as string then
it is easy for the app to figure out which db is which and to link it
with other db settings in the configuration file.
You can store several connections in a hashtable. However, it is best to
open/close connections as you need them and not keep several connections
open.

--
sp**********@ro gers.com (Do not e-mail)
Jan 8 '08 #2
Can hashtable be of type OleDb.OleDbConn ection?

Thanks

Regards

"Spam Catcher" <sp**********@r ogers.comwrote in message
news:Xn******** *************** ***********@127 .0.0.1...
"John" <Jo**@nospam.in fovis.co.ukwrot e in
news:#L******** ******@TK2MSFTN GP02.phx.gbl:
>Can I have an array of type OleDb.OleDbConn ection that has strings as
subscription values? The reason I need this is my app reads a
configuratio n file with db names and their locations and it then
creates all connections and if subscript is the db name as string then
it is easy for the app to figure out which db is which and to link it
with other db settings in the configuration file.

You can store several connections in a hashtable. However, it is best to
open/close connections as you need them and not keep several connections
open.

--
sp**********@ro gers.com (Do not e-mail)

Jan 8 '08 #3
You mean the value part? Sure, why not.
However, I would recommend, as stated in previous post, to avoid retaining
connections - that's the connection pool's job.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"John" <Jo**@nospam.in fovis.co.ukwrot e in message
news:Ox******** *****@TK2MSFTNG P06.phx.gbl...
Can hashtable be of type OleDb.OleDbConn ection?
Jan 8 '08 #4
Thank. Could you tell ma how to declare a hashtable of type
OleDb.OleDbConn ection with a string type subscript?

Thanks

regards
"Miha Markic" <miha at rthand comwrote in message
news:u9******** ******@TK2MSFTN GP02.phx.gbl...
You mean the value part? Sure, why not.
However, I would recommend, as stated in previous post, to avoid retaining
connections - that's the connection pool's job.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"John" <Jo**@nospam.in fovis.co.ukwrot e in message
news:Ox******** *****@TK2MSFTNG P06.phx.gbl...
>Can hashtable be of type OleDb.OleDbConn ection?

Jan 8 '08 #5
What .net version are you using?

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"John" <Jo**@nospam.in fovis.co.ukwrot e in message
news:%2******** **********@TK2M SFTNGP05.phx.gb l...
Thank. Could you tell ma how to declare a hashtable of type
OleDb.OleDbConn ection with a string type subscript?

Thanks

regards
"Miha Markic" <miha at rthand comwrote in message
news:u9******** ******@TK2MSFTN GP02.phx.gbl...
>You mean the value part? Sure, why not.
However, I would recommend, as stated in previous post, to avoid
retaining connections - that's the connection pool's job.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"John" <Jo**@nospam.in fovis.co.ukwrot e in message
news:Ox******* ******@TK2MSFTN GP06.phx.gbl...
>>Can hashtable be of type OleDb.OleDbConn ection?

Jan 8 '08 #6
I am on vs2008, can use any.

Regards

"Miha Markic" <miha at rthand comwrote in message
news:uW******** ******@TK2MSFTN GP04.phx.gbl...
What .net version are you using?

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"John" <Jo**@nospam.in fovis.co.ukwrot e in message
news:%2******** **********@TK2M SFTNGP05.phx.gb l...
>Thank. Could you tell ma how to declare a hashtable of type
OleDb.OleDbCon nection with a string type subscript?

Thanks

regards
"Miha Markic" <miha at rthand comwrote in message
news:u9******* *******@TK2MSFT NGP02.phx.gbl.. .
>>You mean the value part? Sure, why not.
However, I would recommend, as stated in previous post, to avoid
retaining connections - that's the connection pool's job.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"John" <Jo**@nospam.in fovis.co.ukwrot e in message
news:Ox****** *******@TK2MSFT NGP06.phx.gbl.. .
Can hashtable be of type OleDb.OleDbConn ection?


Jan 8 '08 #7
You can use Dictionary<K,Vt hen, i.e.
Dictionary<stri ng, OleDbConnection dict = new Dictionary<stri ng,
OleDbConnection >();
dict.Add("...", conn);

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"John" <Jo**@nospam.in fovis.co.ukwrot e in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>I am on vs2008, can use any.

Regards

"Miha Markic" <miha at rthand comwrote in message
news:uW******** ******@TK2MSFTN GP04.phx.gbl...
>What .net version are you using?

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"John" <Jo**@nospam.in fovis.co.ukwrot e in message
news:%2******* ***********@TK2 MSFTNGP05.phx.g bl...
>>Thank. Could you tell ma how to declare a hashtable of type
OleDb.OleDbCo nnection with a string type subscript?

Thanks

regards
"Miha Markic" <miha at rthand comwrote in message
news:u9****** ********@TK2MSF TNGP02.phx.gbl. ..
You mean the value part? Sure, why not.
However, I would recommend, as stated in previous post, to avoid
retaining connections - that's the connection pool's job.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"John" <Jo**@nospam.in fovis.co.ukwrot e in message
news:Ox***** ********@TK2MSF TNGP06.phx.gbl. ..
Can hashtable be of type OleDb.OleDbConn ection?

Jan 8 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1412
by: Jeremy Ames | last post by:
I have a problem with one of connections using the wrong connection string. I have a form that has three late bound sql connections. Each connection is local to the function that it used in. The problem I am having is that the last connection uses a different username and password to sign in. By the time that the third connection is opened, the other two connections have been opened, closed, and disposed. What is happening is that the third...
3
1383
by: Jeremy Ames | last post by:
Can someone please help with this? Unfortunately, that did not work. "Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote in message news:uwMY%23fquDHA.2308@TK2MSFTNGP11.phx.gbl... Hi Jeremy, Please try using 127.0.0.1 instead of (local) in the connection string: cnTask.ConnectionString="Data Source=127.0.0.1;" +
12
2528
by: Sheldon | last post by:
Hi, I have two arrays that are of the same dimension but having 3 different values: 255, 1 or 2. I would like to set all the positions in both arrays having 255 to be equal, i.e., where one array has 255, I set the same elements in the other array to 255 and visa versa. Does anyone know how to do this without using for loops? Sincerely,
4
1959
by: Sierra | last post by:
Problem: Database connections are not being reused properly. SP_WHO2 shows upwards of 200 connections being created per page request. Most connections exist for 60 seconds then close without being reused. A few connections are reused. SQL System Profiler shows many “Audit Login” and many “RPC: Completed” records for each page request – often involving the exact same SQL statement called in exactly the same manner from within a...
13
1758
by: PRP | last post by:
Hi, Our DBA has complained about the large number of connections from the aspnet_wp process. We have multiple web applications deployed in different virtual directories. I read that the way ADO.NET in-built connection pool works is per app domain. So in a scenario where I am using single connection string (from web.config) and I am closing all connections as recommended, is it correct to assume that ideal number of connections
6
4353
by: Steve Ricketts | last post by:
I have a webservice written in VB.net that opens a connection to SQL Server 2000 with a connection string. The connection remains open for the life of the web service so the ADODB.connection is defined as public and used by a single subroutine, SQLexecute. All recordset definitions are defined in the individual subroutines and destroyed before exit of the subroutine. I would expect only one connection to be made to the SQL Server but...
5
3385
by: Usman Jamil | last post by:
Hi I've a class that creates a connection to a database, gets and loop on a dataset given a query and then close the connection. When I use netstat viewer to see if there is any connection open left, I always see that there are 2 connections open and in "ESTABLISHED" state. Here is the piece of code that I'm using, please tell where I'm doing it wrong. Since this class is being used at many placed in my actual web based application that...
4
3326
by: setiarakesh | last post by:
I have designed a socket Server and developed asynchronous server . It is working fine with 60 Clients which are connecting to ths Server running at Machine (2 GB RAM and OS is Windows 2003 Server)having IP which is Mapped with static IP and Port in firewall . The Programme is working fine with 60 clients and rate if incoing data on the server is 5 -6 string of 1024 byte size are being saved in DataBase. When i try to connect ...
5
3542
by: Cirene | last post by:
I just deployed my new ASP.NET (3.5 FW) site to the hosting company I'm using, webhost4life. NOTE: I HAVE deployed other SQL Server sites to the same account with no issues. Now I'm getting this error. Any idea why? Server Error in '/myuser4/MyWebApp' Application. --------------------------------------------------------------------------------
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8516
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.