protected void Page_Load(object sender, EventArgs e)
{
// This tutorial is provided in part by Server Intellect Web Hosting Solutions http://www.serverintellect.com
// Visit http://www.AspNetTutorials.com for more ASP.NET Tutorials
}
public string GetConnectionString(string _connectionStringsName)
{
System.Configuration.ConnectionStringSettingsCollection config = System.Configuration.ConfigurationManager.ConnectionStrings;
for (int i = 0; i < config.Count; i++)
{
if (config[i].Name.Equals(_connectionStringsName, StringComparison.OrdinalIgnoreCase))
return config[i].ToString();
}
return String.Empty;
}
protected void btn_GetConn_Click(object sender, EventArgs e)
{
this.lblMessage.Text = GetConnectionString(this.tb_connName.Text.Trim());
}
}