Build a connection string from component parameters and display it
using System;
using System.Data.SqlClient;
class MainClass
{
public static void Main(string[] args)
{
SqlConnectionStringBuilder sb2 = new SqlConnectionStringBuilder();
sb2.DataSource = @".\sqlexpress";
sb2.InitialCatalog = "Northwind";
sb2.IntegratedSecurity = true;
sb2.MinPoolSize = 5;
sb2.MinPoolSize = 15;
sb2.LoadBalanceTimeout = 600;
sb2.ConnectionReset = true;
Console.WriteLine("Constructed connection string:");
Console.WriteLine(" " + sb2.ConnectionString);
}
}
Output Constructed connection string:
Data Source=.\sqlexpress;Initial Catalog=Northwind;Integrated Security=True;Min Pool Size=15;Conne
ction Reset=True;Load Balance Timeout=600
|
HTML code for linking to this page:
Related in same category :
-
|