c# - Year and century being swapped when inserting a date into Oracle -
i have following table in oracle:
create table tb_dates ( dt_date date )
and following code in c#:
datatable dt = new datatable(); datacolumn dc = new datacolumn(); dc.datatype = type.gettype("system.datetime"); dc.columnname = "dt_date"; dt.columns.add(dc); (int = 0; < 5; i++) { datarow dr = dt.newrow(); dr["dt_date"] = system.datetime.now; dt.rows.add(dr); } using (oraclebulkcopy bulkcopy = new oraclebulkcopy("data source=orcl;user id=scott;password=tiger", oraclebulkcopyoptions.default)) { bulkcopy.destinationtablename = "tb_dates"; bulkcopy.writetoserver(dt); }
the dates in table must 2014/05/15. but, when select in oracle, have 1420/05/15. year has been reversed.
i'm using oracle 11g , oracle odp.net 12 client. have code work correctly?
Comments
Post a Comment