Problem retrieving data from Stored Procedure from SQL 2005

  • Thread starter Thread starter Prasad
  • Start date Start date
P

Prasad

Hi,
I am creating a stored procedure which contains an output parameter.
Though the procedure is getting compiled properly I am not able to
execute it from within SQL Server Management Studio and also through
an aspx page. I keep getting empty output (not null)

The code:


Create procedure LoginUser


@cust_Password varbinary,
@cust_name varchar,
@cust_id int output


AS


BEGIN


SELECT @cust_id=Id from Customer where Name=@cust_name and
Password=@cust_Password;


END


How can I retreive the value @cust_id ?
 
Use
SELECT Id from Customer where Name=@cust_name and
Password=@cust_Password;

And call ExecuteScalar
 
Hi,
I am creating a stored procedure which contains an output parameter.
Though the procedure is getting compiled properly I am not able to
execute it from within SQL Server Management Studio and also through
an aspx page. I keep getting empty output (not null)

The code:

Create procedure LoginUser

@cust_Password varbinary,
@cust_name varchar,
@cust_id int output

AS

BEGIN

SELECT @cust_id=Id from Customer where Name=@cust_name and
Password=@cust_Password;

END

How can I retreive the value @cust_id ?

Hi

check out this thread, just check the last message

http://forums.asp.net/p/1208409/2362152.aspx

here is a good article that demonstrate Using Output Parameters

http://aspnet.4guysfromrolla.com/articles/062905-1.aspx


Best of luck

Munna
www.munna.shatkotha.com
www.munna.shatkotha.com/blog
www.shatkotha.com
 
Back
Top