select * from currentstock where convert(varchar(10),dDate,121) between '''+datetostr(BeginDateTimePicker1.DateTime)+''' and '''+datetoste(EndDateTimePicker1.DateTime)+''' 改为 select * from currentstock where convert(datetime,convert(varchar(10),dDate,121)) between '''+datetostr(BeginDateTimePicker1.DateTime)+''' and '''+datetoste(EndDateTimePicker1.DateTime)+'''
select * from currentstock where convert(varchar(10),dDate,121) between '''+datetostr(BeginDateTimePicker1.DateTime)+''' and '''+datetoste(EndDateTimePicker1.DateTime)+''' 改为 select * from currentstock where convert(datetime,convert(varchar(10),dDate,121)) between '''+datetostr(BeginDateTimePicker1.DateTime)+''' and '''+datetoste(EndDateTimePicker1.DateTime)+'''to yangpeiyu() 你这不是又 转换成 数据库中的 原有格式:2006-11-05 00:00:00.000 了吗. 格式中包含有 具体时间了.肯定不行的.
把时间段变为 between 2006-11-05 00:00:00 and 2006-11-05 23:59:59
改为
select * from currentstock where convert(datetime,convert(varchar(10),dDate,121)) between '''+datetostr(BeginDateTimePicker1.DateTime)+''' and '''+datetoste(EndDateTimePicker1.DateTime)+'''
这个 开始时候我就试过了.就是空记录我觉得时日期日期格式 ; 只要能把控件 中的得到的日期 :象 2006-5-2 转换成 数据库中日期格式: 2006-05-02 对应起来就可以了.
对于 BeginDateTimePicker1.DateTime 得到的日期 怎么转换
改为
select * from currentstock where convert(datetime,convert(varchar(10),dDate,121)) between '''+datetostr(BeginDateTimePicker1.DateTime)+''' and '''+datetoste(EndDateTimePicker1.DateTime)+'''to yangpeiyu()
你这不是又 转换成 数据库中的 原有格式:2006-11-05 00:00:00.000 了吗. 格式中包含有 具体时间了.肯定不行的.