本文整理匯總了C#中System.Configuration.ConnectionStringSettingsCollection類的典型用法代碼示例。如果您正苦於以下問題:C# ConnectionStringSettingsCollection類的具體用法?C# ConnectionStringSettingsCollection怎麽用?C# ConnectionStringSettingsCollection使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ConnectionStringSettingsCollection類屬於System.Configuration命名空間,在下文中一共展示了ConnectionStringSettingsCollection類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ShowConnectionStrings
static void ShowConnectionStrings()
{
// Get the application configuration file.
System.Configuration.Configuration config =
ConfigurationManager.OpenExeConfiguration(
ConfigurationUserLevel.None);
// Get the conectionStrings section.
ConnectionStringsSection csSection =
config.ConnectionStrings;
for (int i = 0; i <
ConfigurationManager.ConnectionStrings.Count; i++)
{
ConnectionStringSettings cs =
csSection.ConnectionStrings[i];
Console.WriteLine(" Connection String: \"{0}\"",
cs.ConnectionString);
Console.WriteLine("#{0}", i);
Console.WriteLine(" Name: {0}", cs.Name);
Console.WriteLine(" Provider Name: {0}",
cs.ProviderName);
}
}