Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Using SCOPE_IDENTITY instead of @@identity

  • Loading branch information...
commit c015abce2472a1681670dcf2c75e71c24a96f8dc 1 parent 61bb804
Andrei Volkov authored
Showing with 2 additions and 3 deletions.
  1. +2 −3 Massive.cs
5 Massive.cs
View
@@ -502,9 +502,8 @@ private dynamic BuildPagedResult(string sql = "", string primaryKeyField = "", s
if (BeforeSave(ex)) {
using (dynamic conn = OpenConnection()) {
var cmd = CreateInsertCommand(ex);
+ cmd.CommandText = cmd.CommandText + ";SELECT SCOPE_IDENTITY() as newID";
cmd.Connection = conn;
- cmd.ExecuteNonQuery();
- cmd.CommandText = "SELECT @@IDENTITY as newID";
ex.ID = cmd.ExecuteScalar();
Inserted(ex);
}
@@ -670,4 +669,4 @@ private dynamic BuildPagedResult(string sql = "", string primaryKeyField = "", s
return true;
}
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.