You can use for deleting your history from database based on IDprivate void delete_btn_Click(object sender, EventArgs e) {if (!(textBox1.Text == string.Empty && textBox2.Text == string.Empty)){string str = "server = MUNESH;Database=data;UID=sa;Password=reladmin";SqlConnection con = new SqlConnection(str);string query = "Delete from registration where ID= '" + this.textBox1.Text + "' and Password = '" +this.textBox2.Text + "'";SqlCommand cmd = new SqlCommand(query, con);SqlDataReader myreader;try{con.Open();myreader = cmd.ExecuteReader();MessageBox.Show("Deleted", "user information");while (myreader.Read()){}con.Close();}catch (Exception ec){MessageBox.Show(ec.Message);}}else{MessageBox.Show("enter ID or password which you want to delete");} }
refer my article http://www.c-sharpcorner.com/UploadFile/0c1bb2/insert-update-delete-in-gridview-using-single-stored-proce/