如何使用C#.net中的存储过程在oracle表中保存日期
问题描述:
朋友,
我在oracle 10g中有一个表,其中有一个带有日期数据类型的列.
我使用存储过程在该表中插入值.我正在使用以下代码..
hi friends ,
i have table in oracle 10g.in which there are a column with date datatype.
I insert value in that table using stored procedure.i am using following code..
OleDbDataAdapter adp = new OleDbDataAdapter("ins_emp",con);
DataSet ds = new DataSet();
adp.SelectCommand.CommandType = CommandType.StoredProcedure;
adp.SelectCommand.Parameters.AddWithValue("@psdate", "(to_date('"+Label1.Text+ "','mm/dd/yyyy'))");
adp.Fill(ds)
但我得到以下错误..
ORA-01858:在需要数字的地方找到了非数字字符
或如何在Oracle中从.net保存日期.
帮助我解决这个问题.迫切...
提前谢谢.
Randeep Chauhan
but i get the follwing error..
ORA-01858: a non-numeric character was found where a numeric was expected
or how save date from .net in oracle.
Help me on this topic.Its urgent...
Thanks in advance.
Randeep Chauhan
答
使用以下命令:
Use the following :
adp.SelectCommand.Parameters.AddWithValue("@psdate", DateTime.Parse(Label1.Text);