我用ADO控件连接access数据库啊,想在ListView里面显示出来。以下是代码。
procedure TForm1.FormCreate(Sender: TObject);
begin
  mypath:=extractfilepath(paramstr(0));
  shortdateformat:='yyyy/mm/dd';
end;procedure TForm1.RadioButton1Click(Sender: TObject);
begin
   edit1.Text :='';
end;procedure TForm1.RadioButton2Click(Sender: TObject);
begin
      edit1.Text :='';
end;procedure TForm1.RadioButton3Click(Sender: TObject);
begin
          edit1.Text :='';
end;procedure TForm1.RadioButton4Click(Sender: TObject);
begin
             edit1.Text :='';
end;procedure TForm1.Button1Click(Sender: TObject);
var
  content:string;begin
 try
  listview1.Items.Clear ;
   begin
       with DataModule2.ADOQuery1 do
       begin
         content:=edit1.Text ;
          if ComboBox1.ItemIndex=-1 then
           content:='%'+content+'%';
           sql.Clear ;
          if radiobutton1.Checked then
               begin
               sql.Add('select BZM,ZH,YFLH,ZWM from w where code like :BZM ');
               parameters.ParamByName('BZM').Value :=content;
               end;
          if radiobutton2.Checked then
               begin
               sql.Add('select BZM,ZH,YFLH,ZWM from w  where name like :ZM ');
               parameters.ParamByName('ZM').Value :=content;
               end;
          if radiobutton3.Checked then
               begin
               sql.Add('select BZM,ZH,YFLH,ZWM from w where YFLH like :YFLH ');
               parameters.ParamByName('YFLH').Value :=content;
               end;
          if radiobutton4.Checked then
               begin
               sql.Add('select BZM,ZH,YFLH,ZWM from w where ZWM  like :ZWM ');
               parameters.ParamByName('ZWM').Value :=content;
               end;
         open;
          while not eof do
            begin
              with listview1.Items.Add do
                begin
                  caption:=fieldbyname('BZM').AsString ;
                  subitems.add(fieldbyname('ZH').AsString );
                  subitems.add(fieldbyname('YFLH').AsString );
                  subitems.add(fieldbyname('ZWM').AsString );
                  
                end;
                next;
            end;       end;           end;
           except
              messagedlg('查询失败',mterror,[mbok],0);           end;
        end;end.