locked
Passing Date to an Oracle Procedure RRS feed

  • Question

  • User-593639757 posted

    I have a textbox that takes a date (sStartDate) and I am trying to pass that date to my Oracle procedure but getting the following error:

    ORA-01861: literal does not match format string

    How do I fix it?               

    C# code:

    sStartDate = txtStartDate.text;
    DateTime date = DateTime.Parse(sStartDate);
    objCmd.Parameters.Add("start_date", OracleType.DateTime).Value = date.ToString("dd-MMM-yy");

    Thursday, October 24, 2013 7:11 PM

All replies

  • User2117486576 posted

    Try:

    objCmd.Parameters.Add("start_date", OracleDbType.Date).Value = date;

    Assuming that you are using the parameter to compare to a date column.

    Thursday, October 24, 2013 10:17 PM