delphi 怎么添加、删除、修改 dbf数据库数据啊

解决方案 »

  1.   

    数据库的话,网上搜一下吧。
    基本都一样。用 ADO 控件。
      

  2.   

    先搞清楚是什么数据库,光看扩展名不能完全确定
    dbase/foxbase/foxpro?
      

  3.   

    用 Microsoft Visual Foxpro Driver 驱动。下面是我的项目的代码,参考一下
      try
        begin
          adoconnection2.ConnectionString :='Provider=MSDASQL.1;Extended '+
              'Properties="Driver={Microsoft Visual Foxpro Driver};'+
              'SourceType=DBF;SourceDB='+Edit1.Text+'"';
          adoconnection2.Connected := true;
        end;
      except
        begin
          showmessage('不是数据目录,请确认!');
          screen.Cursor := crdefault;
          exit;
        end;
      end; 
      try
        begin
          with adoquery1 do
          begin
            close;
            sql.Clear;
            sql.Add('select STOCK_NUM from sysdata ');
            open;
            if fieldbyname('STOCK_NUM').AsString = '0' then
            begin
              ////
            end;
          end;
        end;