하자 내가 construscter의 클래스 파일의 연결을 열이 난 continuesly 연결을 사용하는 일부 페이지를 가진 하나의 asp.net 응용 프로그램 .....asp.net 연결 개폐
이 있다고 .. .... 지금까지 데이터베이스 작업이 필요한 클래스 ....의 객체를 사용하여 액세스 할
메신저 ...
은 시작에서 응용 프로그램이 있지만, 일부 수술 후 .... 잘 실행 DataGrid (예 : 정렬, 페이징, 기타)에 데이터베이스가있는 경우 .... 느려지 게되고 잠시 후 다시 작업을 시작합니다 .... 당신이 닫는 곳는
public class student_operation
{
public SqlConnection cn = new SqlConnection();
public SqlCommand cmd = new SqlCommand();
public SqlDataAdapter ad = new SqlDataAdapter();
public DataSet rs = new DataSet();
public DataSet rs1 = new DataSet();
public student_operation()
{
//
// TODO: Add constructor logic here
//
try
{
cn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myconnection"].ConnectionString);
cn.Open();
}
catch (Exception)
{
if (cn.State != ConnectionState.Closed)
{
cn.Close();
cn.Open();
}
}
}
}
안녕하세요. 작동합니다 ... 감사합니다. –