c# - Why converting datetime to string gets me the error : ORA-01843: not a valid month -


i have following column :

checkingtime ------------ 1 7/5/2011 2  3  4 5/8/2012 

(the colomn format date.) i'm using datareader read colomns , rows in db1 , insert them db 2 follow :

while (dr.read()) { string finalratingdate = ((dr[19] != dbnull.value) ? convert.tostring(dr[19]) : ""); } 

so when inserting it's supposed check if there's dbnull, if not, insert value, if yes insert "", thing following error :

system.data.oracleclient.oracleexception: ora-01843: not valid month

i error datetimes variable. other variables i'm able convert them string , insert them.

do have idea ?

thank you

i believe exception indicating column in database of type date , can't accommodate empty string. instead of empty string in statement, should initialize variable null, enable set null value in date column. statement be:

string finalratingdate = ((dr[19] != dbnull.value) ? convert.tostring(dr[19]) : null); 

i not sure why converting datetime field string database, should use parameterized query , add datatime object parameter instead of converting string.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -