PC Review


Reply
Thread Tools Rate Thread

Array of db connections with string subscription

 
 
John
Guest
Posts: n/a
 
      8th Jan 2008
Hi

Can I have an array of type OleDb.OleDbConnection 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


 
Reply With Quote
 
 
 
 
Spam Catcher
Guest
Posts: n/a
 
      8th Jan 2008
"John" <(E-Mail Removed)> wrote in
news:#(E-Mail Removed):

> Can I have an array of type OleDb.OleDbConnection 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.

--
(E-Mail Removed) (Do not e-mail)
 
Reply With Quote
 
John
Guest
Posts: n/a
 
      8th Jan 2008
Can hashtable be of type OleDb.OleDbConnection?

Thanks

Regards

"Spam Catcher" <(E-Mail Removed)> wrote in message
news:Xns9A1F19E07CD1Busenethoneypotrogers@127.0.0.1...
> "John" <(E-Mail Removed)> wrote in
> news:#(E-Mail Removed):
>
>> Can I have an array of type OleDb.OleDbConnection 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.
>
> --
> (E-Mail Removed) (Do not e-mail)



 
Reply With Quote
 
Miha Markic
Guest
Posts: n/a
 
      8th Jan 2008
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Can hashtable be of type OleDb.OleDbConnection?


 
Reply With Quote
 
John
Guest
Posts: n/a
 
      8th Jan 2008
Thank. Could you tell ma how to declare a hashtable of type
OleDb.OleDbConnection with a string type subscript?

Thanks

regards


"Miha Markic" <miha at rthand com> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Can hashtable be of type OleDb.OleDbConnection?

>



 
Reply With Quote
 
Miha Markic
Guest
Posts: n/a
 
      8th Jan 2008
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" <(E-Mail Removed)> wrote in message
news:%23$k%(E-Mail Removed)...
> Thank. Could you tell ma how to declare a hashtable of type
> OleDb.OleDbConnection with a string type subscript?
>
> Thanks
>
> regards
>
>
> "Miha Markic" <miha at rthand com> wrote in message
> news:(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Can hashtable be of type OleDb.OleDbConnection?

>>

>
>


 
Reply With Quote
 
John
Guest
Posts: n/a
 
      8th Jan 2008
I am on vs2008, can use any.

Regards

"Miha Markic" <miha at rthand com> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:%23$k%(E-Mail Removed)...
>> Thank. Could you tell ma how to declare a hashtable of type
>> OleDb.OleDbConnection with a string type subscript?
>>
>> Thanks
>>
>> regards
>>
>>
>> "Miha Markic" <miha at rthand com> wrote in message
>> news:(E-Mail Removed)...
>>> 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" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> Can hashtable be of type OleDb.OleDbConnection?
>>>

>>
>>

>



 
Reply With Quote
 
Miha Markic
Guest
Posts: n/a
 
      8th Jan 2008
You can use Dictionary<K,V> then, i.e.
Dictionary<string, OleDbConnection> dict = new Dictionary<string,
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>I am on vs2008, can use any.
>
> Regards
>
> "Miha Markic" <miha at rthand com> wrote in message
> news:(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:%23$k%(E-Mail Removed)...
>>> Thank. Could you tell ma how to declare a hashtable of type
>>> OleDb.OleDbConnection with a string type subscript?
>>>
>>> Thanks
>>>
>>> regards
>>>
>>>
>>> "Miha Markic" <miha at rthand com> wrote in message
>>> news:(E-Mail Removed)...
>>>> 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" <(E-Mail Removed)> wrote in message
>>>> news:(E-Mail Removed)...
>>>>> Can hashtable be of type OleDb.OleDbConnection?
>>>>
>>>
>>>

>>

>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems Loading Large String Array into Array variable ExcelMonkey Microsoft Excel Programming 6 6th May 2009 11:20 PM
Array of db connections with string subscription John Microsoft Dot NET Framework Forms 7 8th Jan 2008 11:52 AM
Array of db connections with string subscription John Microsoft VB .NET 7 8th Jan 2008 11:52 AM
'System.String[]' from its string representation 'String[] Array' =?Utf-8?B?UmFqZXNoIHNvbmk=?= Microsoft ASP .NET 0 4th May 2006 05:29 PM
Cannot create an object of type 'System.String[]' from its string representation 'String[] Array' for the 'Options' property. Hessam Microsoft C# .NET 0 8th Aug 2003 09:45 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:32 PM.