var price,zhuang,wei,time,str:string;
begin
if (combobox2.Text='请选择') or (edit2.Text='') then
price:=''
else if combobox2.Text='大于' then
price:='价格 > '+quotedstr(edit2.Text)
else if combobox2.Text='等于' then
price:='价格 = '+quotedstr(edit2.Text)
else if combobox2.Text='小于' then
price:='价格 < '+quotedstr(edit2.Text)
else price:=''; if combobox3.Text='请选择' then
zhuang:=''
else zhuang:='状况='+quotedstr(combobox3.Text); time:=datetostr(datetimepicker1.Date); if combobox4.Text<>'请选择' then
wei:='放置位置='+quotedstr(combobox4.Text)
else wei:=''; Oraquery1.Close;
Oraquery1.SQL.Clear;
str:='select * from basic_info'; if price<>'' then
begin
str:=str+' where '+ price;
if zhuang<>'' then
str:=str+' and '+zhuang;
if time<>'' then
str:=str+' or '+time;
if wei<>'' then
str:=str+' and '+wei;
end
else begin
if zhuang<>'' then
begin
str:=str+' where '+zhuang;
if time<>'' then
str:=str+' or '+time;
if wei<>'' then
str:=str+' and '+wei;
end
else begin
if time<>'' then
begin
str:=str+' where '+time;
if wei<>'' then
str:=str+' and '+wei;
end
else begin
if wei<>'' then
str:=str+' where '+wei;
end;
end;
end;
Oraquery1.SQL.Add(str);
try
Oraquery1.Open;
except
showmessage('访问数据库出错!');
exit;
end;错误提示说:无效关系运算符
begin
if (combobox2.Text='请选择') or (edit2.Text='') then
price:=''
else if combobox2.Text='大于' then
price:='价格 > '+quotedstr(edit2.Text)
else if combobox2.Text='等于' then
price:='价格 = '+quotedstr(edit2.Text)
else if combobox2.Text='小于' then
price:='价格 < '+quotedstr(edit2.Text)
else price:=''; if combobox3.Text='请选择' then
zhuang:=''
else zhuang:='状况='+quotedstr(combobox3.Text); time:=datetostr(datetimepicker1.Date); if combobox4.Text<>'请选择' then
wei:='放置位置='+quotedstr(combobox4.Text)
else wei:=''; Oraquery1.Close;
Oraquery1.SQL.Clear;
str:='select * from basic_info'; if price<>'' then
begin
str:=str+' where '+ price;
if zhuang<>'' then
str:=str+' and '+zhuang;
if time<>'' then
str:=str+' or '+time;
if wei<>'' then
str:=str+' and '+wei;
end
else begin
if zhuang<>'' then
begin
str:=str+' where '+zhuang;
if time<>'' then
str:=str+' or '+time;
if wei<>'' then
str:=str+' and '+wei;
end
else begin
if time<>'' then
begin
str:=str+' where '+time;
if wei<>'' then
str:=str+' and '+wei;
end
else begin
if wei<>'' then
str:=str+' where '+wei;
end;
end;
end;
Oraquery1.SQL.Add(str);
try
Oraquery1.Open;
except
showmessage('访问数据库出错!');
exit;
end;错误提示说:无效关系运算符
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货