By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,261 Members | 1,688 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,261 IT Pros & Developers. It's quick & easy.

How to get list of connection string keywords available in sqlclie

P: n/a
How can I get the list of connection string's keywords available in sqlclient
programmatically? I have found the list in here
http://msdn2.microsoft.com/en-us/lib...ng(vs.80).aspx
but I want to get this list programmatically.
Sep 19 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"Peter" <Pe***@discussions.microsoft.comschrieb
How can I get the list of connection string's keywords available in
sqlclient programmatically? I have found the list in here
http://msdn2.microsoft.com/en-us/lib...ng(vs.80).aspx
but I want to get this list programmatically.
I think it's not possible. At least the provider specific keyword's are
interpreted by the data provider.

But maybe the System.Data.SqlClient.SqlConnectionStringBuilder class helps?
Armin

Sep 19 '07 #2

P: n/a
Hi Armin,

It seems that I can get the list from an instance of
System.Data.SqlClient.ConnectionStringBuilder. Not sure how to get it yet
since I'm not familiar of collections.

"Armin Zingler" wrote:
"Peter" <Pe***@discussions.microsoft.comschrieb
How can I get the list of connection string's keywords available in
sqlclient programmatically? I have found the list in here
http://msdn2.microsoft.com/en-us/lib...ng(vs.80).aspx
but I want to get this list programmatically.

I think it's not possible. At least the provider specific keyword's are
interpreted by the data provider.

But maybe the System.Data.SqlClient.SqlConnectionStringBuilder class helps?
Armin

Sep 20 '07 #3

P: n/a
"Peter" <Pe***@discussions.microsoft.comschrieb
Hi Armin,

It seems that I can get the list from an instance of
System.Data.SqlClient.ConnectionStringBuilder. Not sure how to get
it yet since I'm not familiar of collections.

"Armin Zingler" wrote:
"Peter" <Pe***@discussions.microsoft.comschrieb
How can I get the list of connection string's keywords available
in sqlclient programmatically? I have found the list in here
http://msdn2.microsoft.com/en-us/lib...ng(vs.80).aspx
but I want to get this list programmatically.
I think it's not possible. At least the provider specific
keyword's are interpreted by the data provider.

But maybe the System.Data.SqlClient.SqlConnectionStringBuilder
class helps?

I didn't think of this class as being a collection like data source, more I
pointed to it because you can browse the available properties/keywords and
explicitly set them "early bound" without the need to fill the values into a
connection string. Though, I had a closer look at it, finding that it
implements IEnumerable, so you can use For Each:

Dim sb As New System.Data.SqlClient.SqlConnectionStringBuilder

sb.ConnectTimeout = 17
sb.DataSource = "test"

For Each pair As KeyValuePair(Of String, Object) In sb
'access the Key and Value propertis of object 'pair'
Next

May I ask why you need this?

Armin

Sep 20 '07 #4

P: n/a
Thanks Armin. I'm thinking about providing administrator of an application
the ability to set some of those keywords and then build the connection
string dynamcially. I can hardcode them instead of retrieving them
programmatically.
I wonder whether those keywords will expand automatically when the
underlying sqlclient provider support more keywords.

Using your sample coding will only fetch those keywords which have values
assigned. If I want to get all the keywords, I need to go thru the
keys.syncroot array and I don't think I can use KeyValuePair to loop thru
them.

Peter

"Armin Zingler" wrote:
"Peter" <Pe***@discussions.microsoft.comschrieb
Hi Armin,

It seems that I can get the list from an instance of
System.Data.SqlClient.ConnectionStringBuilder. Not sure how to get
it yet since I'm not familiar of collections.

"Armin Zingler" wrote:
"Peter" <Pe***@discussions.microsoft.comschrieb
How can I get the list of connection string's keywords available
in sqlclient programmatically? I have found the list in here
http://msdn2.microsoft.com/en-us/lib...ng(vs.80).aspx
but I want to get this list programmatically.
>
I think it's not possible. At least the provider specific
keyword's are interpreted by the data provider.
>
But maybe the System.Data.SqlClient.SqlConnectionStringBuilder
class helps?


I didn't think of this class as being a collection like data source, more I
pointed to it because you can browse the available properties/keywords and
explicitly set them "early bound" without the need to fill the values into a
connection string. Though, I had a closer look at it, finding that it
implements IEnumerable, so you can use For Each:

Dim sb As New System.Data.SqlClient.SqlConnectionStringBuilder

sb.ConnectTimeout = 17
sb.DataSource = "test"

For Each pair As KeyValuePair(Of String, Object) In sb
'access the Key and Value propertis of object 'pair'
Next

May I ask why you need this?

Armin

Sep 20 '07 #5

P: n/a
"Peter" <Pe***@discussions.microsoft.comschrieb
Thanks Armin. I'm thinking about providing administrator of an
application the ability to set some of those keywords and then build
the connection string dynamcially. I can hardcode them instead of
retrieving them programmatically.
I wonder whether those keywords will expand automatically when the
underlying sqlclient provider support more keywords.

Using your sample coding will only fetch those keywords which have
values assigned. If I want to get all the keywords, I need to go
thru the keys.syncroot array and I don't think I can use
KeyValuePair to loop thru them.
Why don't you put all possible keywords into a list? Has to be done once
only.
Armin

Sep 21 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.