请教有关查询语句.出现Missing SQL property错误~~
相关代码如下:
procedure Tcx_Form.SpeedButton4Click(Sender: TObject);
begin
if (Trim(combobox3.Text)='') or (Trim(edit2.Text)='') or (Trim(combobox4.Text)='') then
begin
Application.MessageBox('请设置查询条件.','提示',64);
Exit;
end
else
begin
with DM.GZQuery do
begin
close;
SQL.clear;
if combobox3.ItemIndex=0 then
begin
if combobox4.ItemIndex=0 then
begin
SQL.add(' select * from gztj where 故障名称 = '+ QuotedStr(Trim(edit1.Text)) +' ');
end
else if combobox4.ItemIndex=1 then
begin
SQL.add(' select * from gztj where 故障名称 like '+ QuotedStr(Trim(edit1.Text)) +' ');
end;
end
else if combobox3.ItemIndex=1 then
begin
if combobox4.ItemIndex=0 then
begin
SQL.add(' select * from gztj where 故障现象 = '+ QuotedStr(Trim(edit1.Text)) +' ');
end
else if combobox4.ItemIndex=1 then
begin
SQL.add(' select * from gztj where 故障现象 like '+ QuotedStr(Trim(edit1.Text)) +' ');
end;
end
else if combobox3.ItemIndex=2 then
begin
if combobox4.ItemIndex=0 then
begin
SQL.add(' select * from gztj where 故障类型 = '+ QuotedStr(Trim(edit1.Text)) +' ');
end
else if combobox2.ItemIndex=1 then
begin
SQL.add(' select * from gztj where 故障类型 like '+ QuotedStr(Trim(edit1.Text)) +' ');
end;
end;
Open;
end;
if DM.GZQuery.RecordCount>0 then
begin
DM.GZDSc.DataSet := DM.GZQuery;
dbGrid2.DataSource := DM.GZDSc;
end
else
begin
DM.GZQuery.Close;
Application.MessageBox('没有找到符合条件的数据.','提示',64);
end;
end;
end;
运行时出现提示说 GZQuery Missing SQL property!我怎么检查也找不出问题!请大家帮忙看看,谢谢了!
问题点数:0、回复次数:1Top
1 楼li_zhen028()回复于 2006-05-04 15:43:24 得分 0
'select * from gztj where 故障类型 = '''+ QuotedStr(Trim(edit1.Text))+''''
你没给分是没人会回答你的,碰上我心情好Top




