在执行 dbCommand.CommandType = System.Data.CommandType.Text;
dbCommand.CommandText = sql;
OleDbDataAdapter adapter = new OleDbDataAdapter();
adapter.SelectCommand = dbCommand;
adapter.Fill(cDataSet,sTableName);
时,报错了
"[2008-6-26 22:56:11]:查询数据库时发生错误\r\nSQL:
select id, countingBeginTime, taskBeginTime, taskEndTime, studycenter, taskstate, lastUpdateTime from I_Counting where 1=1
and to_date(to_char(countingBeginTime, 'yyyy-mm-dd'), 'yyyy-mm-dd') >= to_date('2008-6-26', 'yyyy-mm-dd')
and to_date(to_char(countingBeginTime, 'yyyy-mm-dd'), 'yyyy-mm-dd') <= to_date('2008-6-26', 'yyyy-mm-dd')
\r\nSystem.Data.OleDb.OleDbException: 未指定的错误\r\n发生了一个 Oracle 错误,但无法从 Oracle 中检索错误信息。\r\n数据类型不被支持。\r\n
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)\r\n
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)\r\n
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)\r\n
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)\r\n
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)\r\n
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)\r\n
at System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)\r\n
at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)\r\n
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)\r\n
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)\r\n at Open.DataAccess.DataBaseOperate.Search(String l_sQuery, String l_sTableName) in e:\\oemslib\\open\\dataaccess\\databaseoperate.cs:line 143"
dbCommand.CommandText = sql;
OleDbDataAdapter adapter = new OleDbDataAdapter();
adapter.SelectCommand = dbCommand;
adapter.Fill(cDataSet,sTableName);
时,报错了
"[2008-6-26 22:56:11]:查询数据库时发生错误\r\nSQL:
select id, countingBeginTime, taskBeginTime, taskEndTime, studycenter, taskstate, lastUpdateTime from I_Counting where 1=1
and to_date(to_char(countingBeginTime, 'yyyy-mm-dd'), 'yyyy-mm-dd') >= to_date('2008-6-26', 'yyyy-mm-dd')
and to_date(to_char(countingBeginTime, 'yyyy-mm-dd'), 'yyyy-mm-dd') <= to_date('2008-6-26', 'yyyy-mm-dd')
\r\nSystem.Data.OleDb.OleDbException: 未指定的错误\r\n发生了一个 Oracle 错误,但无法从 Oracle 中检索错误信息。\r\n数据类型不被支持。\r\n
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)\r\n
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)\r\n
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)\r\n
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)\r\n
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)\r\n
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)\r\n
at System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)\r\n
at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)\r\n
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)\r\n
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)\r\n at Open.DataAccess.DataBaseOperate.Search(String l_sQuery, String l_sTableName) in e:\\oemslib\\open\\dataaccess\\databaseoperate.cs:line 143"
解决方案 »
- 错误 1 命名空间“Microsoft.Office”中不存在类型或命名空间名称“Interop”(是缺少程序集引用吗?)
- 【【【【【求助】】】】jquery,getJSON IE6跨域请求到了,但是不返回结果。附代码。
- VS2008新建网站出来https
- 文件上传,并生成缩略图奇怪的错误
- sql合并查询
- 怎样根据客户端的session给某个用户弹出窗口
- 给你科头了,在线等。求人做一个文章发布系统。报酬详谈。
- LinkButton.Enabled = false时,如果设置LinkButton的ForeColor=Color.Red时红色无效。怎样设置LinkButton即是禁止又是红色的?
- 求救!!简单问题!万分着急!再线等!谢谢先
- 用datalist来分页 "Private page.aspx As String "错以哪里啊?(附部分代码)
- [2008/06/27]code
- 求一个网上商城的B/S的系统
我觉得原因可能是 adapter.Fill(cDataSet,sTableName) 无法识别一些数据库中的类型我的数据库是
CREATE TABLE I_COUNTING
(
ID VARCHAR2(44 BYTE) NOT NULL,
COUNTINGBEGINTIME TIMESTAMP(6) NOT NULL,
TASKBEGINTIME TIMESTAMP(6) NOT NULL,
TASKENDTIME TIMESTAMP(6) NOT NULL,
STUDYCENTER VARCHAR2(44 BYTE) NOT NULL,
TASKSTATE NUMBER(10),
LASTUPDATETIME TIMESTAMP(6) NOT NULL
)不知道是不是无法识别类型timestamp(6)哪位高手指示一下啊
TimeStamp应该是一个唯一的二进制类型,应该不能直接转换日期型.
Is a data type that exposes automatically generated, unique binary numbers within a database. timestamp is generally used as a mechanism for version-stamping table rows. The storage size is 8 bytes. The timestamp data type is just an incrementing number and does not preserve a date or a time. To record a date or time, use a datetime data type.
http://msdn.microsoft.com/en-us/library/ms182776.aspx
如果 sql改成
select id, to_char(countingBeginTime, 'yyyy-mm-dd') countingBeginTime, to_char(taskBeginTime, 'yyyy-mm-dd') taskBeginTime, to_char(taskEndTime, 'yyyy-mm-dd') taskEndTime, studycenter, taskstate, to_char(lastUpdateTime, 'yyyy-mm-dd') lastUpdateTime from I_Counting adapter.Fill(cDataSet,sTableName) 就没问题 并能正常显示