Mike,
Sergey's right about using SCOPE_IDENTITY() in your StoredProc and have the parameter be an OUTPUT parameter.
In your .NET application, when you set the parameters for the SqlCommand, you'll need to also specify that the parameter for this counter have either an Output or an InputOutput direction:
Command.Parameters("@MyCounter).Direction = ParameterDirection.InputOutput
~~Bonnie
>Hello,
>I have a table that store records that have an auto incrementing field called Counter. In my VB.NET app I am triggering a stored procedure to insert a record into this table, but I would also like to somehow get the Counter value back to my app. Any advice on how to do this?
>
>TIA!
>
>MAC