Delete Button code
protected void button_delete_Click(object
sender, EventArgs e)
{
sqlgetdata getdata = new sqlgetdata ();
getdata.deletemain(Convert.ToInt32(TextBox_stuid.Text));
Label_reply.Text = "Record
deleted";
TextBox_stuid.Text = "";
TextBox_name.Text = "";
TextBox_course.Text = "";
TextBox_fee.Text = "";
}
public void deletemain(Int32
ss)
{
Int32 sa = ss;
string querystring = "delete from
student where stu_id=" + sa;
string sqlconstring =
"Data Source= SHYAM\\SQLEXPRESS ;initial catalog=college; integrated
security=True ";
SqlConnection sqlcn = new
SqlConnection(sqlconstring);
Sqlcommand sqlcmd=new
Sqlcommand(querystring,sqlcn);
sqlcn.Open();
sqlcmd.ExecuteNonQuery();
sqlcn.Close();
}
No comments:
Post a Comment