When you insert a record, you get the new method of inserting the record ID value immediately.
// when you insert a record, you get the new method of inserting the record ID value immediately.
SqlConnection myconn1;
String SQL1;
myconn1 = new SqlConnection (configurationmanager.connectionstrings["BaseConnectionString"). ConnectionString);
Myconn1. Open ();
SQL1 = "INSERT into BIAOZHUNPIN_LQ (LQR,LQRQ,CZY,TXRQ,BZ) VALUES (' + LQRTextBox.Text.ToString () +" ', ' "+ lqrqtextbox.te Xt. ToString () + "', '" + CZYTextBox.Text.ToString () + "', '" + TXRQTextBox.Text.ToString () + "', '" + Strbz + "') SELECT @ @identi Ty ";
SqlCommand mycommand = new SqlCommand (SQL1, myconn1);
Int32 newid;
NEWID = Int32.Parse (mycommand. ExecuteScalar (). ToString ()); Gets the ID value of the newly inserted record
Myconn1. Close ();
Myconn1. Open ();
Response.Redirect ("Biaozhunpinlqmxadd.aspx?") Biaozhunpinlqid= "+ newid. ToString ()); Gets the ID of the newly inserted record, which you can refer to.