哈,你要有数据库的名字才行啊 with query1 do begin sql.clear; sql.text:='select * from 表名 where 证号>'+edit1.text+' and 证号<'+edit2.text; execsql; end;此时,在query1中的 数据就是你想要的数据了
to a12345(唯微) 我写的不对吗?请指教一下,thanks
一:按凭证号查: select * from table where id >strtoint(edit1.text) and id <strtoint(edit2.text);二:按日期查: 1、先用两个DateTimePicker控件,一个输开始日期,另一个输截止日期; 2、select * from table where date >=DateTimePicker1.date and date <=DateTimePicker2.date;
如果输入的日期截止日期比开始日期早则:if DateTimePicker1.date<DateTimePicker2.date then select * from table where date >=DateTimePicker1.date and date <=DateTimePicker2.dateelse application.messagebox('截止日期不能小于开始日期!',‘’,mb_iconerror);
表名:Customer 字段: Id MakeDate 'select * from Customer where Id>='''+Edit1.Text+''' and Id<='''+Edit2.Text+'''''select * from Customer where MakeDate between FormatDateTime('yyyy-mm-dd',Date1) and FormatDateTime('yyyy-mm-dd',Date2)
select something from table between 范围1 and 范围2 我记得书上有。
回复人: a12345(唯微) (2002-1-25 19:10:23) 得0分 哈,你要有数据库的名字才行啊 with query1 do begin sql.clear; sql.text:='select * from 表名 where 证号>'+edit1.text+' and 证号<'+edit2.text; execsql; end; 这句中 EDIT控件可否用下拉选日期的那个控件代替呢?
with query1 do
begin
sql.clear;
sql.text:='select * from 表名 where 证号>'+edit1.text+' and 证号<'+edit2.text;
execsql;
end;此时,在query1中的 数据就是你想要的数据了
我写的不对吗?请指教一下,thanks
select * from table where id >strtoint(edit1.text) and id <strtoint(edit2.text);二:按日期查:
1、先用两个DateTimePicker控件,一个输开始日期,另一个输截止日期;
2、select * from table where date >=DateTimePicker1.date and date <=DateTimePicker2.date;
如果我用下拉列表框(combobox)选择工作单位怎么设置使下拉列表的工作单位不重呀?
select * from table where date >=DateTimePicker1.date and date <=DateTimePicker2.dateelse
application.messagebox('截止日期不能小于开始日期!',‘’,mb_iconerror);
这句加在哪呀?
谢谢
????/
你不要在等下去了,把你的问题整理一下,寄给我,我会作统一的回答。你的问题我也粗略了解一下,对于我没有问题!相信我,没错的!
好吗?
[email protected]
query.sql.add( 'select * from table where (tabl1.id >=:1) and (table1.id <=:2) ' )
query.parambyname('1').asstring := edit1.text;
query.parambyname('2').asstring := edit2.text;
query.open;
你就在这帮我吧
应加在你要将“工作单位名称”添加到ComboBox中时查询时用到的,主要是关键字“DISTINCT”:消除重复的查询值!
是按证号查询比如从某号(输入在EDIT中)至某号
还有一个就是时间的查询我要查从某年月日至某年月日。有谁能帮我吗?给代码
TO:
说实话,你没有给出具体的“表名”、“字段名”、“字段类型”,大家只能给出通用的SELECT语句!
'select * from Customer where Id>='''+Edit1.Text+''' and Id<='''+Edit2.Text+'''''select * from Customer where MakeDate between FormatDateTime('yyyy-mm-dd',Date1) and FormatDateTime('yyyy-mm-dd',Date2)
我记得书上有。
哈,你要有数据库的名字才行啊
with query1 do
begin
sql.clear;
sql.text:='select * from 表名 where 证号>'+edit1.text+' and 证号<'+edit2.text;
execsql;
end;
这句中 EDIT控件可否用下拉选日期的那个控件代替呢?