Possible Duplicate:
Why does select SCOPE_IDENTITY() return a decimal instead of an integer?
I’m using following code to determine last inserted id on my column
var sql = "SELECT IDENT_CURRENT('TableName')";
var query = session.CreateSQLQuery(sql);
var lastInsertedId = query.UniqueResult();
But when I’m try to use these id value
photo.Property = session.Load<Domain.Property>(lastInsertedId);
I got following error message
Provided id of the wrong type. Expected: System.Int32, got System.Decimal
How can I overcome these ? Thanks
lastInsertedIdis getting returned asdecimalyou will have to convert it into toIntand pass it to thesession.Loadmethod