make select @@IDENTITY; a long?
Posted
by acidzombie24
on Stack Overflow
See other posts from Stack Overflow
or by acidzombie24
Published on 2010-05-21T19:01:45Z
Indexed on
2010/05/21
19:10 UTC
Read the original article
Hit count: 134
I am grabbing the last rowid and i am doing this select @@IDENTITY
pk = (long)cmd.ExecuteScalar();
I get an invalid typecast bc this is int instead of long. Why doesnt this return a long? can i make it return long?
Solution for now is to use
pk = Convert.ToInt64(cmd.ExecuteScalar());
© Stack Overflow or respective owner