SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=ServerName;Initial Catalog=DataBaseName;Integrated Security=true";
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "delete from tableName where Id='" + txtID.Text +"'";
cmd.Connection = con;
SqlDataAdapter da = new SqlDataAdapter();
da.UpdateCommand = cmd;
con.Open();
int x;
x = cmd.ExecuteNonQuery();
if (x > 0)
{
alert('Your Data Is Delete Successfully.......!!!!!.');
</script>;";
Page.ClientScript.RegisterStartupScript(this.GetType(), "myJScript1", script);
}
No comments:
Post a Comment