Site Search:
Sign in | Join | Help
4Penny.net

VB.NET

Notes, Tricks and Tips on VB.NET

Returning a value from a Stored Procedure through SQLHelper

We're currently using the Microsoft DAAB 2.0. Recently I tried to get a return value from a stored procedure through SQLHelper.ExecuteNonQuery. It does return an integer, does it not. Well, sort of. The integer returned is the number of rows affected in the query, or 0 if 'set nocount' is on.

Turns out that you'll have to add

select @@identity

after the insert statement, and pick it up in VB with SQLHelper.executeScalar.

 

Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add

About Steve Gray

Steve is a seasoned (translate: old) developer in VB and ASP.NET. He spends most of his time in Dynamics GP, writing custom mods for consulting firms. Crystal reports, eConnect, VS Tools for Dynamics... anything that comes along.