Wrox Programmer Forums
|
BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5
This is the forum to discuss the Wrox book Beginning Visual Basic 2005 Databases by Thearon Willis; ISBN: 9780764588945
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 24th, 2006, 09:25 PM
Registered User
 
Join Date: Mar 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Return output variable to VB from SQL stored proc

I'd like to use an IDENTITY column instead of create a new GUID for the Time Tracker application.

I modified the sprocs to return the ID via SCOPE_IDENTITY(), but what steps would I need to take to incorporate the ID returned from the sproc as an output variable to the VB code?
 
Old March 27th, 2006, 10:24 PM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

You'll need to have an Output parameter in your stored procedures to return an Integer data type containing the Identity value. Then you'll need to set the SQLCommand object with an output parameter. After you execute your stored procedure, you'll want to query the output parameter value in the Parameters collection of the SQLCommand object.

Thearon





Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing return value of a Stored Proc in a Session mahajanvit ASP.NET 2.0 Basics 0 November 2nd, 2006 10:16 AM
Return 2 Recordsets from 1 Stored Proc Gordie Classic ASP Databases 0 July 3rd, 2006 05:34 PM
problem with a stored proc trying to return blobs Phrozt SQL Server 2000 2 May 12th, 2006 09:36 AM
How i can OUTPUT in Stored Proc yoord SQL Server 2000 2 July 19th, 2004 03:11 PM
problems with stored proc and output parameters zieg42 VB.NET 2002/2003 Basics 1 June 12th, 2004 07:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.