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"
8 个解决方案
#1
数据类型不被支持。-----能想到的问题:1.SQL语句有问题;2.取出的数据类型与要填充的表结构类型不匹配
#2
sql没有问题
我觉得原因可能是 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)
哪位高手指示一下啊
我觉得原因可能是 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)
哪位高手指示一下啊
#3
TimeStamp应该是一个唯一的二进制类型,应该不能直接转换日期型.
#4
MSDN的描述
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
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
#5
应该用datetime数据类型替换timestamp类型
#6
Oracle 数据库有timestamp数据类型??
#7
再顶一下 现在确认是 timestamp类型 在加载时有问题
如果 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) 就没问题 并能正常显示
如果 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) 就没问题 并能正常显示
#8
应该是这样了 谁还有补充啊
#1
数据类型不被支持。-----能想到的问题:1.SQL语句有问题;2.取出的数据类型与要填充的表结构类型不匹配
#2
sql没有问题
我觉得原因可能是 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)
哪位高手指示一下啊
我觉得原因可能是 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)
哪位高手指示一下啊
#3
TimeStamp应该是一个唯一的二进制类型,应该不能直接转换日期型.
#4
MSDN的描述
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
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
#5
应该用datetime数据类型替换timestamp类型
#6
Oracle 数据库有timestamp数据类型??
#7
再顶一下 现在确认是 timestamp类型 在加载时有问题
如果 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) 就没问题 并能正常显示
如果 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) 就没问题 并能正常显示
#8
应该是这样了 谁还有补充啊