Pass a Date to stored procedure

Discussion in 'ASP .Net Web Services' started by Mike Lopez, Jan 25, 2005.

  1. Mike Lopez

    Mike Lopez Guest

    Hello.

    I have a stored procedure that accepts a Date field as one of its
    parameters.

    When I try to run the webservice that I wrote to call the SP I get an "Value
    in date, time, or timestamp string not valid."

    Below is the code. The parameter is "Vehicle_Inservice_date". When the code
    runs in an old ASP page, the parameter is defined as type "adDate" and it
    works fine.

    How do I pass a date field to a SP? I'm using C#. I guess I need the
    equivalent of "adDate"(?)

    Thanks in advance,

    Mike

    Here's the code:
    [WebMethod]
    public string Eligibility_Category(
    string Product_Code,
    string Vehicle_Make_Code,
    int Vehicle_Year,
    int Vehicle_Odometer,
    DateTime Vehicle_Inservice_Date)
    {
    cnAS400.Open();
    myReader = cmAS400.ExecuteReader(CommandBehavior.CloseConnection);
    return myReader.ToString();
    }
     
    Mike Lopez, Jan 25, 2005
    #1
    1. Advertisements

  2. Mike Lopez

    Mike Lopez Guest

    Nevermind. I wasn't assigning the input parameter values.

    Thanks anyway,

    Mike
     
    Mike Lopez, Jan 25, 2005
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.