我的写法是这样的,虽然是可以查询出来,但总觉得不够好,请问有没有更好的方法啊,
请指教.
procedure TForm1.mydbgridDblClick(Sender: TObject);
var
i:integer;
begin
for i:=0 to mydbgrid.FieldCount -1 do
begin
case i of
0:begin
if mydbgrid.SelectedIndex =0 then
begin
ad.close;
ad.sql.Clear;
ad.sql.Add('select * from users where user_ids like '+''''+'%'+inputbox('模糊查询','请输入代号','')+'%'
+'''');
ad.open;
end;
end;
1:begin
if mydbgrid.SelectedIndex =1 then
begin
ad.close;
ad.sql.Clear;
ad.sql.Add('select * from users where user_names like '+''''+'%'+inputbox('模糊查询','请输入姓名','')+'%'
+'''');
ad.open;
end;
end;