Czytanie łańcuchów połączeń
Kod szybkiego odczytywania łańcuchów połączeń z bieżącej konfiguracji
using System.Configuration;
...
Label1.Text = "";
for (int i = 0; i < ConfigurationManager.ConnectionStrings.Count; i++)
{
Label1.Text += ConfigurationManager.ConnectionStrings[i].Name;
Label1.Text += ConfigurationManager.ConnectionStrings[i].ToString() +
"<br />";
}
Efekt działaniaa
LocalSqlServerData Source=127.0.0.1;Initial Catalog=aspnetdb;Persist Security Info=True;User ID=student;Password=student LocalMySqlServer aspnetdbConnectionStringData Source=127.0.0.1;Initial Catalog=aspnetdb;Persist Security Info=True;User ID=student;Password=student
|