var str:string;
begin
str:='select * from pjinfom where '''+Formatdatetime('yyyy-mm-dd',datetimepicker1.date)+''' < pjtime and pjtime< '''+Formatdatetime('yyyy-mm-dd',datetimepicker2.date)+ '''';
if Edit1.text <> '' thenstr:=str+' and pjid = '''+ Edit1.text +'''';if Edit2.text <> '' then
str:=str+' and name = '''+Edit2.text+'''';
if Edit3.text <> '' then
str:=str+' and dname = '''+Edit3.text+'''';
if edit4.text <> '' then
str:=str+' and job = '''+edit4.text+'''';
if edit5.Text <> '' then
str:=str+' and pjpace = '''+edit5.text+'''';with dm.Query4 do
begin
Close;
SQL.Clear;
SQL.Add(str);
如果edit1.text要求输入的是数字不是字付怎么半
begin
str:='select * from pjinfom where '''+Formatdatetime('yyyy-mm-dd',datetimepicker1.date)+''' < pjtime and pjtime< '''+Formatdatetime('yyyy-mm-dd',datetimepicker2.date)+ '''';
if Edit1.text <> '' thenstr:=str+' and pjid = '''+ Edit1.text +'''';if Edit2.text <> '' then
str:=str+' and name = '''+Edit2.text+'''';
if Edit3.text <> '' then
str:=str+' and dname = '''+Edit3.text+'''';
if edit4.text <> '' then
str:=str+' and job = '''+edit4.text+'''';
if edit5.Text <> '' then
str:=str+' and pjpace = '''+edit5.text+'''';with dm.Query4 do
begin
Close;
SQL.Clear;
SQL.Add(str);
如果edit1.text要求输入的是数字不是字付怎么半
if not (Key in ['1','2','3','4','5','6','7','8','9','0'])then Key := #0;
if not (Key in ['0'..'9', #13, #8]) then Key := #0;
if not key>9 and key<0 then key:=#0;
这样不是就可以了吗。至于其他的条件你自己家就好了。