in this when i updated data then not updated it is deleted in update button but there is update fuction

how i solve this problem that data are update????/

here is updated fuction

 {


            string constring = @"Data Source=.\SQLEXPRESS;Database=htm;Integrated Security=True";
            SqlConnection con = new SqlConnection(constring);
            con.Open();
            DataTable dt = new DataTable();
            SqlCommand com = new SqlCommand("updatereserveinfo", con);
            com.CommandType = CommandType.StoredProcedure;
            com.Parameters.Add(new SqlParameter("@Reservation_id", myreserv.Reservation_ID1));
            com.Parameters.Add(new SqlParameter("@Guest_id", myreserv.Guest_name));
            com.Parameters.Add(new SqlParameter("@Room_ID", myreserv.Room_no));
            com.Parameters.Add(new SqlParameter("@Service_id", myreserv.Service));
            com.Parameters.Add(new SqlParameter("@No_of_days", myreserv.No_of_days));
            com.Parameters.Add(new SqlParameter("@Check_in",myreserv.Check_in));
            com.Parameters.Add(new SqlParameter("@Check_out",myreserv.Check_out));
            com.ExecuteNonQuery();
            con.Close();

and button code

private void UPDTE_Click(object sender, EventArgs e)
        {
            try
            {
                Reservation_manager manage = new Reservation_manager(info);
                info.Reservation_ID1 = Convert.ToInt32(txt_reser.Text);
                info.Guest_name = text_guest.SelectedValue.ToString();
                info.Room_no = Convert.ToInt32(txt_room.Text);
                info.Service = txt_servce.SelectedValue.ToString();
                info.No_of_days = Convert.ToInt32(txt_days.Text);
                info.Check_in = Convert.ToDateTime(check_in.Text);
                info.Check_out = DateTime.Parse(check_out.Text);
                manage.updatereserve();
                //dataGridView1.DataSource = info.GetRecords();
                MessageBox.Show("Reservation  Update Successfully!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                dt.Clear();
                dt = info.GetRecords();
                dataGridView1.DataSource = dt;
                clearfield();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

store procedure

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[updatereserveinfo]

@Reservation_ID int,
@guest_id int,
@Room_id int,
@service_id int,
@no_of_days int,
@check_in datetime,
@check_out datetime

as
begin
update Reservation
 set 
Guest_ID=@guest_id,Room_ID=@Room_id,Service_ID=@service_id,No_of_days=@no_of_days,Check_in=@check_in,Check_out=@check_out
where Reservation_ID=@Reservation_ID
end

How you say that the record is deleted? can you pls post the SELECT procedure too?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.