title: Retrieve the most recent primary key from database after form submission C#
body: <p>I have a Webforms project and I have the information going into a database. My question is, after submitting the page, how can I retrieve and display the newly created <code>ID</code> (primary key) on the next page in a label? Is this even possible to do?</p>
  
  <p>I have this code for retrieving the ID based of an old project I did:</p>
  
  <pre><code>SqlCommand da3 = new SqlCommand(strSelectCmd3, conn);
  da3.CommandType = CommandType.StoredProcedure;
  
  SqlDataAdapter ds3 = new SqlDataAdapter();
  ds3.SelectCommand = da3;
  
  DataSet dsPerson3 = new DataSet();
  ds3.Fill(dsPerson3);
  
  Response.Redirect("Submitted.aspx?ID=" + dsPerson3.Tables[0].Rows[0]["CremationID"].ToString());
  </code></pre>