AJAXLoadProgressForm.aspx:
GetGridViewByConditionForm.aspx:
protected void Page_Load(개체 보낸 사람, EventArgs e)
{
if (Request["id"] != null)
{
SqlConnection conn=null;
SqlCommand cmd = null;
SqlDataAdapter 어댑터 = null;
해 보세요
{
conn = new SqlConnection();
conn.ConnectionString = ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString;
콘.오픈();
cmd = 새로운 SqlCommand();
cmd.Connection = 연결;
cmd.CommandType = CommandType.Text;
String cmdStr = "dbo.Customers에서 * 선택";
if (Request["id"].ToString()!=String.Empty)
{
cmdStr = " where CustomerID= '" Request["id"].ToString() "'";
}
cmd.CommandText = cmdStr;
어댑터 = 새 SqlDataAdapter(cmd);
DataSet ds = new DataSet();
adapter.Fill(ds);
this.gvData.DataSource = ds;
this.gvData.DataBind();
}
catch
{
Response.Write("오류가 발생했습니다!");
Response.Flush();
응답.끝();
}
드디어
{
if (adapter != null)
{
adapter.Dispose();
}
if (cmd != null)
{
cmd.Dispose();
}
if ((conn != null) && (conn.State == ConnectionState.Open))
{
conn.Close();
}
}
}
}