c# - MVC using ODP.NET getting ORA-01840 -


i writing simple mvc application using odp.net. trying call pl/sql proc inserts record.

here simple pl/sql:

procedure spaddcountry(pgisrecid in country.gisrecid%type,                      pcountrycode in country.countrycode%type,                      pcountryname in country.countryname%type,                      pcurrencycode in country.currencycode%type,                      peuterritory in country.euterritory%type,                      pfatcastatus  in country.fatcastatus%type,                      pfatf in country.fatf%type,                      pfscountrycode in country.countrycode%type,                      pinsertedby in country.insertedby%type,                      pinsertedon in country.insertedon%type,                      planguages in country.languages%type,                      pncct in country.ncct%type) pragma autonomous_transaction; begin   insert country (gisrecid, countrycode, countryname, currencycode,           euterritory, fatcastatus, fatf, fscountrycode, insertedby,           insertedon, languages, ncct)   values(pgisrecid, pcountrycode, pcountryname, pcurrencycode,           peuterritory, pfatcastatus, pfatf, pfscountrycode, pinsertedby,           pinsertedon, planguages, pncct);   commit; end; 

i having difficulty passing date parameter, pinsertedon, stored proc. have verified web form retrieves form data , calls addcountry method below, in turns calls stored proc, spaddcountry, after populating of parms.

here snippet of mvc c# code.

i following exception: "ora-01840 input value not long enough date format".

        public void addcountry(country acountry)  //because country object field names match form field names automatically bound!!         {             string oradb = "data source=xyz;user id=xyz;password=xyz;";             oracleconnection conn = new oracleconnection(oradb);             oraclecommand cmd = conn.createcommand();             cmd.commandtext = "tstpack.spaddcountry";               cmd.commandtype = commandtype.storedprocedure;             ...             oracleparameter paraminsertedby = new oracleparameter();             paraminsertedby.parametername = "pinsertedby";             paraminsertedby.value = acountry.insertedby;  //acountry.insertedby string             cmd.parameters.add(paraminsertedby);  //            cultureinfo ci = new cultureinfo("en-us");  //flail...             oracleparameter paraminsertedon = new oracleparameter();             paraminsertedon.parametername = "pinsertedon"; //            paraminsertedon.value = datetime.now;  //just testing see if it's webform issue //            paraminsertedon.value = convert.todatetime(datetime.now.tostring(), ci);  //flail!             paraminsertedon.value = acountry.insertedon;  //acountry.insertedon datetime             cmd.parameters.add(paraminsertedon);                   ...             conn.open();             cmd.executenonquery();  //crash!  ora-01840                 conn.close();                 } 

just verify flow of program working, tried removing date parm "pinsertedon" pl/sql , parm list above, , worked fine. know going off of rails date. can tell me how pass date oracle mvc webform? there sort of type cast needed? appreciate example too.

thanks much!

ps, did try changing parm type varchar2 in pl/sql , doing conversions myself in pl/sql, automatic mvc binder getting in way, forcing property of paraminsertedon.oracletype datetime. tried forcing varchar2, no luck there either...


Comments