Problem retrieving data from Stored Procedure from SQL 2005

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Prasad

    #1

    Problem retrieving data from Stored Procedure from SQL 2005

    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 ?
  • Munna

    #2
    Re: Problem retrieving data from Stored Procedure from SQL 2005

    On May 27, 3:35 pm, Prasad <mahashabdepra. ..@gmail.comwro te:
    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

    A broad category of Microsoft tools, languages, and frameworks for software development. Designed to support developers in building, debugging, and deploying applications across various platforms.


    here is a good article that demonstrate Using Output Parameters




    Best of luck

    Munna



    Comment

    • SoftLion

      #3
      Re: Problem retrieving data from Stored Procedure from SQL 2005

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

      And call ExecuteScalar


      Comment

      Working...