제목 : 예제. SqlConnection 클래스를 사용한 DB Open 및 Close(C#)
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%
SqlConnection objCon;
objCon = new SqlConnection();
string strCon = "server=localhost;database=Pubs;user id=sa;password=1234";
objCon.ConnectionString = strCon;
objCon.Open();
Response.Write("Connection Opened<br>");
objCon.Close();
Response.Write("Connection Closed<br>");
%>