self.SUMQuery.SQL.Text:='select distinct sum(合计) from GZLB where 时间>='"+self.dateoneDBLookupComboBox.Text+"' and 时间<='"+self.datesecondDBLookupComboBox.Text+"';
两个LookupComboBox的内容均为时间类型!例如:2007-9-6.
我的想法是算出用户需要查询的某一时间段收入总合计!用的是ADOQuery,帮忙高手!

解决方案 »

  1.   

    你应该使用between xxxx and xxxx
      

  2.   

    如果你用的数据库是Access
    那么日期时间需用“#”括起#2007-9-6# 而不是 "2007-9-6"
      

  3.   

    你是否"时间"定义的是date类型,是的话convert(varchar(10),时间)
      

  4.   

    'select distinct sum(合计) from GZLB where 时间>='"+self.dateoneDBLookupComboBox.Text+"' and 时间<='"+self.datesecondDBLookupComboBox.Text+"'';//<='"+self.datesecondDBLookupComboBox.Text+"'';////+"''