Author: johnhrschuster | Posted on: 1/12/2009 9:25:55 PM | Views : 343

Somethings which should be simple are often much more complex than they need to be.

An example is how does one get the (Data Source) value from a connection string in the web.config????

I have a connection string in the web.config

<add name="VMSConnectionString"
     connectionString="Data Source=GoodServer;Initial Catalog=VMS;Integrated Security=False;User ID=VMSUser;Password=nosuchluck;"
     providerName="System.Data.SqlClient"/> 

There are  thousands of posts on how to get the string that has has the entire connection string for the connection (VMSConnectionString).

I want just the (Data source) value of the string in this case (GoodServer) without having to use string functions on the connection string, something like:

dim sServerName = ConnectionString.DataSource.ToString

There wa ...

Go to the complete details ...