Oracle C#处理时间类型的Insert

首先如果直接
 
parm.Value=DateTime.Now;
 
insert into table (TheTime)Value(@parm);
 
执行sql就会报错 --------------ORA-01861: 文字与格式字符串不匹配
 
ADO.NET并没做到oracle转换。。所以oracle不兼容。
 
解决方案:
 
//先把时间转换为stirng
parm.Value=DateTime.Now.ToString("G");     
 
//Sql中调用oralce的to_date函数将string转换为Date类型
insert into table (TheTime)Value(to_date(@parm,'yy-mm-dd hh24:mi:ss'));
原文地址:https://www.cnblogs.com/rongfengliang/p/3695780.html