topher-b
12/8/2016 - 8:47 PM

Get ID back when inserting a SQL record

Get ID back when inserting a SQL record

cmd.Parameters.Add(new SqlParameter
{
  ParameterName = "@InsertedID",
  Direction = ParameterDirection.Output
});
int insertedId = cmd.ExecuteNonQuery();