假设你的字段名为Mydate。SQL.ADD(format('Select * from table1 where Mydate between "%s" and "%s"',[datetimetostr(Datetimepicker1.date),datetimetostr(Datetimepicker2.date)]));试一试。
解决方案 »
- 请教tcpclient控件发送数据一次最多发送多少字节?
- 线程中 TBitmap 操作,报错“Out of system resources”?
- 服务程序中怎么用timer?
- 怎样拦截对richedit中字符的删除、覆盖等消息并对这些操作进行提醒?
- 怎样从一部分文件中读取其中的一部分文件~~~~~~~~~~~~~~~
- if嵌套问题,简单!
- 一个关于SHFileOperation()函数的问题
- 何处有适合delphi初学者的网站,介绍几个,有技术资料,简单实例的
- 请做过delphi程序和指纹仪连接的朋友帮忙
- 请问delphi的系统函数,非可视化类从哪里可以查出来?给分150
- 用Delphi 5 调用 VC++ 6 的dll类中的函数出现问题(Access Violation)
- 请问在Tedit的On Exit事件中能得到焦点所在吗?
字段為字符型
table1.filtered:=true;
table1.filter:='mydate>='+chr(39)+datetostr(datetimepicker1.date)+chr(39)+'and mydate<='+chr(39)+datetostr(datetimepicher1.date)+chr(39);
直接顯示table1中的數据就行了
table1.filter:='';
with Table1 do
begin
Filtered:=False;
Filter:='Birthday>='+DateToStr(DateTimePicker1.Date)+' and Birthday<='+
DateToStr(DateTimePicker2.Date);
Filtered:=True;
end;
BeginTime,EndTime,str_sql:string;
begin
BeginTime:=FormatDateTime('yyyy-mm-dd',DtpBegin.date);
EndTime:=FormatDateTime('yyyy-mm-dd',DtpEnd.date); str_sql:='select * from tablename '+
'where (生日字段 between '''+BeginTime+''' and '''+EndTime+''')';
with Query do
begin
close;
sql.clear;
sql.add(str_sql);
open;
end;
end;
procedure displayinfo;
var bdate:string;
edate:string;
begin
bdate:=formatdatetime('yyyy-mm-dd',DateTimePicker1.Date);
edate:=formatdatetime('yyyy-mm-dd',DateTimePicker2.Date);
str_sql:='select birthday from tablename where birthday between ('''+bdate
+''','''+edate+''')';
query1.Active:=false;
query1.sql.Clear;
query1.sql.Add(str_sql);
query1.Active:=true;
end;