procedure TForm2.Button8Click(Sender: TObject);
var
str1,str2:string;begin
with adoquery2 do
begin
str1:=datetimetostr(DateTimePicker3.datetime);
str2:=datetimetostr(DateTimePicker4.datetime);
if ComboBox4.Text='' then
begin
close;
sql.Clear;
sql.Add('select * from sj where yh='''+yhs+''' and date1>='''+str1+''' and date1<='''+str2+'''') ;
open;
end
else
begin
if ComboBox3.text='' then
begin
close;
sql.Clear;
sql.Add('select * from sj where date1<=:'''+str1+''' and date1>=:'''+str2+''' and zc='''+ComboBox4.text+''' and yh='''+yhs+''' ') ;
open;
end
else
begin
close;
sql.Clear;
sql.Add('select * from sj where date1<=:'''+str1+''' and date1>=:'''+str2+''') and zc='''+ComboBox4.text+''' and ly='''+ComboBox3.text+''' and yh='''+yhs+''' ') ;
open;
end;
end;
end;
end;
var
str1,str2:string;begin
with adoquery2 do
begin
str1:=datetimetostr(DateTimePicker3.datetime);
str2:=datetimetostr(DateTimePicker4.datetime);
if ComboBox4.Text='' then
begin
close;
sql.Clear;
sql.Add('select * from sj where yh='''+yhs+''' and date1>='''+str1+''' and date1<='''+str2+'''') ;
open;
end
else
begin
if ComboBox3.text='' then
begin
close;
sql.Clear;
sql.Add('select * from sj where date1<=:'''+str1+''' and date1>=:'''+str2+''' and zc='''+ComboBox4.text+''' and yh='''+yhs+''' ') ;
open;
end
else
begin
close;
sql.Clear;
sql.Add('select * from sj where date1<=:'''+str1+''' and date1>=:'''+str2+''') and zc='''+ComboBox4.text+''' and ly='''+ComboBox3.text+''' and yh='''+yhs+''' ') ;
open;
end;
end;
end;
end;
解决方案 »
- 急,请帮帮忙,关于DLL的问题
- 关于ActiveX控件版本更新的问题,急啊!!!!!!
- 如何把文本数据显示为波型图、棒图
- 我在panel上放了一个TImag,当图片很大时,怎么让panel自动出现滚动条?
- ?报表里QRDBText面的Mask属性能否把时间(2002-2-3 8:03)格式化为8:03!!!
- 如何控制ADOQUERY的记录集
- 怎样响应从外部拖动一文本块到某MEMO中。急急急!!!
- BDE数据库的问题。
- 帮忙写一个sql语句
- 如何在SQL的WHERE中使用DELPHI的日期型数据比较!
- delphi调用vc dll问题
- SocketConnection1 属性中的Loginprompt 有什么用途?设置为false和true有什么区别?
可以用cast
说错了cast是sql,应该这样
SELECT cdate( '2002-02-01 ') >cdate( '2002-02-02 ')
sql.Add('select * from sj where date1 BETWEEN DateValue('''+str1+''') and DateValue('''+str2+''') and zc='''+ComboBox4.text+''' and yh= '''+yhs+'''') ;