System.Configuration.Configuration rootWebConfig =
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/MyWebSiteRoot");
System.Configuration.ConnectionStringSettings connString;
if (rootWebConfig.ConnectionStrings.ConnectionStrings.Count > 0)
{
connString =
rootWebConfig.ConnectionStrings.ConnectionStrings["testConnectionString"];
if (connString != null)
Response.Write("connection string = "+
connString.ConnectionString);
else
Response.Write("No Northwind connection string");
}
沒有留言:
張貼留言