Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         long id = long.Parse(Request.QueryString["id"].ToString());
         db.ExecuteNonQuery("DELETE FROM [Category] WHERE ID = '" + id + "'");
         Response.Redirect("/");
     }catch {}
 }
Ejemplo n.º 2
0
 protected void bntAdd_Click(object sender, EventArgs e)
 {
     if (txtName.Text != "")
     {
         try
         {
             string SQL = "INSERT INTO [Category](Name,Status) VALUES ('" + txtName.Text + "','" + rdlStatus.SelectedValue + "')";
             db.ExecuteNonQuery(SQL);
             Response.Redirect("/");
         }
         catch (Exception ex)
         {
             Response.Write("<script>alert('" + ex.Message + "');</script>");
         }
     }
     else
     {
         Response.Write("<script>alert('Name is not empty');</script>");
     }
 }