Using layers won't return value from stored procedure

Discussion in 'ASP .Net' started by JB, Jul 20, 2010.

  1. JB

    JB Guest

    Hello Community

    In my ASP.Net program using C# I call a
    stored procedure but no memberno value returns. This is how
    I call the method from C#:

    int membernum = 0;
    dset = loadNewMember(memberno);
    membernum = memberno;

    --- This layer calls the stored procedure:

    public DataSet loadNewMember(int memberno)
    {
    DataSet dset1 = new DataSet();

    string dsetErrors = "";
    SqlParameter[] Params = { new SqlParameter("@memberno", memberno) };

    try
    {
    if ("spGetNewMember", @Params, 30)
    {
    return dset1 ;
    }
    return dset1;
    }
    catch (Exception ex)
    {
    dsetErrors = ex.Message;
    }
    return dset1 ;
    }


    ---This is the stored procedure that calls that doesn't return the value for
    memberno:

    Alter PROCEDURE [dbo].[spGetNewMember]
    (@memberno int)
    AS
    BEGIN
    Select @memberno = max(ID)
    From MemberTable
    return @memberno
    END
    go


    Why doesn't the memberno get returned?

    Jeff
    --
    JB
    JB, Jul 20, 2010
    #1
    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. Neo Chou
    Replies:
    1
    Views:
    769
  2. Paul
    Replies:
    1
    Views:
    372
    =?Utf-8?B?UmFtaXJvIENhbGRlcm9u?=
    Jan 19, 2004
  3. Nick
    Replies:
    8
    Views:
    3,267
  4. =?Utf-8?B?RGFuIFNpa29yc2t5?=

    Using Stored Procedure in SqlDataSource Won't Workd

    =?Utf-8?B?RGFuIFNpa29yc2t5?=, Jul 28, 2006, in forum: ASP .Net
    Replies:
    10
    Views:
    3,496
    aadames
    Oct 31, 2007
  5. philip
    Replies:
    2
    Views:
    11,563
    bruce barker \(sqlwork.com\)
    Aug 10, 2006
Loading...

Share This Page