2 Replies Latest reply: Feb 14, 2013 7:06 AM by 991101 RSS

    odp.net 11 and error  message: "ORA-1843: not a valid month"


      I installed odp.net 11 client on my Windows 7 and try to use it with my asp.net application for database connection (Oracle 11g).

      I got error: "ORA-1843: not a valid month" when trying to run code below:
      string date1 = "28/02/2013";
      OracleConnection conn = new OracleConnection("Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=;User Id=aspa2;Password=aspa2;");
      OracleCommand cmd = new OracleCommand();
      cmd.Connection = conn;
      OracleParameter pmt = New OracleParameter("date1", OracleDbType.Date, 8);
      pmt.Direction = ParameterDirection.Input;
      cmd.Parameters.Add(pmt).Value = date1;
      cmd.CommandText = "select * from MyTable where MyFieldDate=date1  ;";
      On my Windows Registry (HKEY_LOCAL_MACHINE\Software\Oracle) I changed all values of key NLS_LANG to: LATIN AMERICAN SPANISH_PERU.WE8MSWIN1252 and restarted my PC.

      Same web application works OK with ODP.NET 10.1, but it's not with this odp.net version 11.

      Also, I tried to add this code to force recognition of date format:
      OracleGlobalization sg = conn.GetSessionInfo();
      sg.DateFormat = "DD/MM/YYYY";
      But no success.

      Is it a bug or is there a solution?