Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Return unique identifier
Message
De
07/09/2005 12:09:02
 
 
À
06/09/2005 10:47:06
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01047020
Message ID:
01047371
Vues:
9
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform