V
vadim
Hi,
I am writing an asp.net app, where I insert some data into a table that
contains an identity column ID and I need to know after the insert what was
the ID value just created. In my Client server development I usually use
select @@identity to get this info, but it doesn't work in ado.net.
Here is what I do
-open connection
- use sql command to execute non query
- create another instance of sql command using the same connection and this
sql command contains select @@Identity query
- then I get sqldatareader from sqlcommand.executereader
- and if reader.read I am trying to getvalue(0), it contains errors.
What am I doing wrong here?
Thank you
Vadim
I am writing an asp.net app, where I insert some data into a table that
contains an identity column ID and I need to know after the insert what was
the ID value just created. In my Client server development I usually use
select @@identity to get this info, but it doesn't work in ado.net.
Here is what I do
-open connection
- use sql command to execute non query
- create another instance of sql command using the same connection and this
sql command contains select @@Identity query
- then I get sqldatareader from sqlcommand.executereader
- and if reader.read I am trying to getvalue(0), it contains errors.
What am I doing wrong here?
Thank you
Vadim