Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return unique identifier
Message
From
07/09/2005 12:09:02
 
 
To
06/09/2005 10:47:06
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01047020
Message ID:
01047371
Views:
10
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
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform