SqlConnection conn = null;
SqlCommand delcomm = null;
int count = 0;
using (conn = new SqlConnection(connstr))
{
if (conn.State == ConnectionState.Closed)
{
conn.Open();
}
delcomm = new SqlCommand(DelCmt, conn);
delcomm.Parameters.AddWithValue("@id", this.hdnCid.Value.Trim());
count = delcomm.ExecuteNonQuery();
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
}
if (count > 0)
{
//자기자신이 자기자신을 불러오는 부분
string s = string.Format("<script>alert('{0}') ; {1}</script>", "삭제성공 ", " document.location.href=document.location.href;");
Response.Write(s);
}
else
{
string s = string.Format("<script>alert('{0}')</script>", "삭제실패");
Response.Write(s);
return;
}
댓글 영역