Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 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 November 17th, 2008, 02:13 PM
Authorized User
 
Join Date: Jan 2004
Posts: 30
Thanks: 1
Thanked 0 Times in 0 Posts
Default Capturing Output Parameter Value

When I execute my stored procedure, I get the following error message:
Procedure or function 'usp_InsertEmployeesTodaysLogin' expects parameter '@Cnt', which was not supplied.
No rows affected.
(0 row(s) returned)
@Cnt =
@RETURN_VALUE =
Finished running [dbo].[usp_InsertEmployeesTodaysLogin].
My stored procedure is:
ALTER PROCEDURE dbo.usp_InsertEmployeesTodaysLogin
(
    @UserID char(8),
    @Today datetime,
    @SSNLogon char(15),
    @Cnt int output
    )
as
BEGIN
    select @Cnt=count(UserID) FROM ATTTblAttendance
        WHERE (UserID=@UserID and Today=@Today and SSNLogon = @SSNLogon)
        RETURN @Cnt
        If (@Cnt=0)
BEGIN

INSERT INTO ATTTblAttendance
           (UserID, Today, SSNLogon)
VALUES (@UserID,@Today,@SSNLogon)
END
ELSE
RETURN @Cnt
END

I need to capture @Cnt for use in my ADO.NET app.

Appreciate your assistant.

Gail

 
Old November 19th, 2008, 08:52 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 246
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Supply @Cnt parameter and make sure the type is INPUTOUTPUT.







Similar Threads
Thread Thread Starter Forum Replies Last Post
output parameter SKhna ASP.NET 2.0 Basics 3 February 25th, 2008 10:58 AM
Output parameter sybase C# goser C# 2005 2 October 24th, 2007 03:17 AM
How to return an output parameter dyaneshwaran SQL Language 0 January 12th, 2006 05:29 AM
Capturing cmd output Chris Beach C# 0 October 3rd, 2003 04:34 PM





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