select * from table1 where mdate>='2003-06-01' 正常
select * from table1 where mdate<='2003-06-31' 也正常可是 select * from table1 where mdate>='2003-06-01' and mdate<='2003-06-31' 就出错了!错误信息:
从 char 数据类型到 datetime 数据类型的转换导致 datetime 值越界。请问为什么?
select * from table1 where mdate<='2003-06-31' 也正常可是 select * from table1 where mdate>='2003-06-01' and mdate<='2003-06-31' 就出错了!错误信息:
从 char 数据类型到 datetime 数据类型的转换导致 datetime 值越界。请问为什么?
改为
select * from table1 where mdate>='2003-06-01' and mdate<='2003-07-01'
我用select * from Student where name='a'
就可以查到
用select * from Student where name='abc'
就查不到了
而数据库中的确有name是a和abc的两项
不知道什么原因
至于楼主的问题按前面几位说的试试就行了
建议在把日期写到SQL语句中,先判断时间是否合法
COleDateTime oleDate;
BOOL bValid = oleDate.ParseDateTime("2003-6-31");
或者把语句放到查询分析其中执行看看是否正确就比较容易找到问题之所在