Problem retrieving data from Stored Procedure from SQL 2005

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 ?
 
S

SoftLion

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

And call ExecuteScalar
 
M

Munna

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top