1 using System;
 2
using System;
 2 using Microsoft.Practices.EnterpriseLibrary.Data;
 3
using Microsoft.Practices.EnterpriseLibrary.Data;
 3 4
 4 public partial class Basic_DeleteControl : System.Web.UI.UserControl
 5
public partial class Basic_DeleteControl : System.Web.UI.UserControl
 5
 ...{
 6
...{
 6
 protected void Page_Load(object sender, EventArgs e) ...{
 7
    protected void Page_Load(object sender, EventArgs e) ...{
 7 // 넘겨져 온 쿼리스트링 값 검사
 8
        // 넘겨져 온 쿼리스트링 값 검사
 8
 if (String.IsNullOrEmpty(Request["Num"])) ...{
 9
        if (String.IsNullOrEmpty(Request["Num"])) ...{
 9 Response.Write("잘못된 요청입니다.");
10
            Response.Write("잘못된 요청입니다.");
10 Response.End();
11
            Response.End();
11 }
12
        }
12
 else ...{
13
        else ...{
13 lblNum.Text = Request["Num"];
14
            lblNum.Text = Request["Num"];
14 }
15
        }
15 }
16
    }
16
 protected void btnDelete_Click(object sender, EventArgs e) ...{
17
    protected void btnDelete_Click(object sender, EventArgs e) ...{
17 // 넘겨온 번호 값에 해당하는 데이터 삭제(단, 예전 암호가 맞다면...)
18
        // 넘겨온 번호 값에 해당하는 데이터 삭제(단, 예전 암호가 맞다면...)
18 int result = DatabaseFactory.CreateDatabase("ConnectionString").
19
        int result = DatabaseFactory.CreateDatabase("ConnectionString").
19 ExecuteNonQuery(
20
            ExecuteNonQuery(
20 "DeleteBasic", txtPassword.Text, Request["Num"]);
21
                "DeleteBasic", txtPassword.Text, Request["Num"]);
21
 if (result == -1) ...{
22
        if (result == -1) ...{
22 lblError.Text = "암호가 틀립니다.";    
23
            lblError.Text = "암호가 틀립니다.";    
23 }
24
        }
24
 else ...{
25
        else ...{
25 Response.Redirect("List.aspx"); // 리스트로 이동
26
            Response.Redirect("List.aspx"); // 리스트로 이동
26 }
27
        }
27 }
28
    }
28 }
29
}
29