如果是日期按道理是没问题的.
楼主试试把BeginDateTimePicker1.DateTime用tostring("yyyy-MM-dd")试一下吧.

解决方案 »

  1.   

    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)+'''
      

  2.   

    或者不用convert(varchar(10),dDate,121)) 直接用 dDate
      

  3.   

    或者不用convert(varchar(10),dDate,121)) 直接用 dDate
    这个 开始时候我就试过了.就是空记录我觉得时日期日期格式 ;  只要能把控件 中的得到的日期 :象 2006-5-2 转换成 数据库中日期格式: 2006-05-02 对应起来就可以了.
    对于  BeginDateTimePicker1.DateTime  得到的日期 怎么转换
      

  4.   

    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  了吗. 格式中包含有 具体时间了.肯定不行的.
      

  5.   

    把时间段变为 between 2006-11-05 00:00:00 and 2006-11-05 23:59:59