with PatientQuery do
try
begin
close;
sql.Clear;
sql.Add ('select * from MP');
sql.Add('where MP.Pdiag=:aa');
ParamByName('aa').AsString:=combobox1.text;//想要根据combobox中选择的项来查询,这里该怎么写?
Prepare;
Open;
end;
except
showmessage('无此记录')
end;
try
begin
close;
sql.Clear;
sql.Add ('select * from MP');
sql.Add('where MP.Pdiag=:aa');
ParamByName('aa').AsString:=combobox1.text;//想要根据combobox中选择的项来查询,这里该怎么写?
Prepare;
Open;
end;
except
showmessage('无此记录')
end;
sql.Add(' where MP.Pdiag=:aa');
combobox1.text始终是你选择的项
sql.Add('where MP.Pdiag=:aa'); //Pdiag是什么类型
ParamByName('aa').AsString:=combobox1.text;
sql.Open;
begin
close;
sql.Clear;
sql.Add ('select * from MP');
sql.Add('where MP.Pdiag=:aa');
ParamByName('aa').AsString:= trim(combobox1.text);
try
Open;
except
showmessage('无此记录')
end;
end;
现在语句是对的,就是无法查询出服务器上的数据