실제로 데이터베이스 연결은 다음과 같습니다. 이제 연결 풀링을 소개하고자합니다. 당신은 connection pooling 메커니즘의 이점을 얻을 특정 작업을 수행 할 필요가 없습니다연결 C#의 Windows Forms에서 풀링
public static string dbpath()
{
try
{
string strcon = @"Data Source=local\SQLEXPRESS;Initial Catalog=aniv;Integrated Security=True";
SqlConnection con = new SqlConnection(strcon);
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
return strcon;
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
return "0";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return "0";
}
}
연결 풀링은 기본적으로 사용됩니다. 'con.Open()'/''con.Close();'와 물리적 인 연결을 혼동하지 마십시오. 후드 .NET에서 적절하게 관리합니다. –
자세히 ..., –
[SQL Server 연결 풀링 (ADO.NET)] (http://msdn.microsoft.com/en-us/library/8xx3tyca.aspx) – Habib