Problem retrieving data from Stored Procedure from SQL 2005

Discussion in 'ASP .Net' started by Prasad, May 27, 2008.

  1. Prasad

    Prasad Guest

    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 ?
     
    Prasad, May 27, 2008
    #1
    1. Advertising

  2. Prasad

    SoftLion Guest

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

    And call ExecuteScalar
     
    SoftLion, May 27, 2008
    #2
    1. Advertising

  3. Prasad

    Munna Guest

    On May 27, 3:35 pm, Prasad <> 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
     
    Munna, May 27, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    411
  2. news.sbcglobal.net
    Replies:
    2
    Views:
    644
    Erland Sommarskog
    Jun 11, 2006
  3. =?Utf-8?B?U2lycGxheWE=?=

    Retrieving Images stored in SQL Server 2005

    =?Utf-8?B?U2lycGxheWE=?=, Jul 8, 2006, in forum: ASP .Net
    Replies:
    7
    Views:
    2,635
    S. Justin Gengo
    Jul 12, 2006
  4. iHavAQuestion
    Replies:
    1
    Views:
    380
    Lloyd Sheen
    May 1, 2008
  5. Sumanta Das
    Replies:
    2
    Views:
    174
    Robert Klemme
    Jul 4, 2008
Loading...

Share This Page