How to created edit page by calling values inserted by Sp?
Hi every body
I did one webform for insertion details by passing the values using stored procedure to my database .
I want to create an edit page for the same details so when a user select a recored from gridview it will take him/her to that recored details for editing (Note: My form has checkboxes ,dropdownmenues,radiobuttons,etc..):
this the code I'm using for insertion in the save button :
cmd = new SqlCommand("sp_Main_Information", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@REG_Date", dt);
cmd.Parameters.AddWithValue("@NAME", name);
cmd.Parameters.AddWithValue("@ADDRESS", Address);
cmd.Parameters.AddWithValue("@YEAR", Year);
cmd.Parameters.AddWithValue("@CURRENT_GPA ", gpa);
cmd.Parameters.AddWithValue("@ATTCH_ID1", img1);
cmd.Parameters.AddWithValue("@ATTCH_ID2 , img2);
cmd.Parameters.AddWithValue("@REMARKS", remarks.Text);
dr = cmd.ExecuteReader();
dr.Read();
int xx = int.Parse(dr[0].ToString());
Response.Write(xx);
for (i = 0; i < chktype.Items.Count; i++)
{
if (chktype.Items[i].Selected == true)
{
cmd = new SqlCommand();
cmd.CommandText = "insert into tblItemstb values ('" + chktype.Items[i].Text + "'," + xx + ")";
cmd.Connection = con;
cmd.ExecuteNonQuery();
}
}
dr.Close();
cmd.ExecuteNonQuery();
dr = cmd.ExecuteReader();
dr.Read();
int yy = int.Parse(dr[0].ToString());
Response.Write(yy);
for (i = 0; i < chkoption.Items.Count; i++)
{
if (chkoption.Items[i].Selected == true)
{
cmd = new SqlCommand();
cmd.CommandText = "insert into tbloptions values ('" + chkoption.Items[i].Text + "'," + yy + ")";
cmd.Connection = con;
cmd.ExecuteNonQuery();
}
}
dr.Close();
cmd.ExecuteNonQuery();
con.Close();
lbldone.Text = "Record Added Successfully!";
}
}
can anybody help me in how to Create Edit Form with the same format of the insertion form . :(