Haz 18 2009

Retrieve individual data from ConnectionString

Category: ASP.NETLatif @ 18:04

   If you want to retrieve data(password ,UserID,DataSource,InitialCatalog) , you can use SqlConnectionStringBuilder (From .NET Framework 2.0, there is System.Data.Common.DbConnectionStringBuilder  and its derived classes (SqlConnectionStringBuilder for SqlServer))

string connectionString = WebConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString;
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(connectionString);

string password = builder.Password;
string username = builder.UserID;
string dataSource = builder.DataSource;
string initialCatalog = builder.InitialCatalog;


Tags: ,


Dinnerware Sets Dinnerware Sets United States says:

Couldn?t be written any better. Reading this post reminds me of my old room mate! He always kept talking about this. I will forward this article to him. Pretty sure he will have a good read. Thanks for sharing!