Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem retrieving data from Stored Procedure from SQL 2005

Reply
Thread Tools

Problem retrieving data from Stored Procedure from SQL 2005

 
 
Prasad
Guest
Posts: n/a
 
      05-27-2008
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 ?
 
Reply With Quote
 
 
 
 
SoftLion
Guest
Posts: n/a
 
      05-27-2008
Use
SELECT Id from Customer where Name=@cust_name and
Password=@cust_Password;

And call ExecuteScalar


 
Reply With Quote
 
 
 
 
Munna
Guest
Posts: n/a
 
      05-27-2008
On May 27, 3:35 pm, Prasad <mahashabdepra...@gmail.com> wrote:
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stored Procedure + sql server 2005 + insertion Sumanta Das Ruby 2 07-04-2008 04:03 PM
parameters in an Stored procedure(SQL server 2005) iHavAQuestion ASP .Net 1 05-01-2008 02:15 PM
Retrieving Images stored in SQL Server 2005 =?Utf-8?B?U2lycGxheWE=?= ASP .Net 7 07-12-2006 03:26 PM
Create XML in ASP.NET 2.0 then use for joined table in SQL Server 2005 Stored Procedure news.sbcglobal.net ASP .Net 2 06-11-2006 08:55 AM
Cannot make a Web Reference to Web Service created (HTTP Endpoint) on SQL 2005 stored procedure tovbinm@gmail.com ASP .Net 0 05-21-2006 08:20 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57