SHARE
TWEET

Untitled

a guest Jul 17th, 2017 36 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["DataContext"].ConnectionString))
  2. {
  3.     con.Open();
  4.     var sc = new SqlCommand("InsertOrUpdate", con);
  5.     sc.CommandType = System.Data.CommandType.StoredProcedure;
  6.     sc.Parameters.AddWithValue("code", "some string code");
  7.     var o = sc.ExecuteScalar(); // is null. cannot step into
  8.     int newPrimaryKey = Convert.ToInt32(o); // stays zero
  9. }
RAW Paste Data
Top