怎么备份和恢复access里的一个表??
最好有源代码?
解决就给分

解决方案 »

  1.   

    with adoquery1 do
    begin
      close;
      sql.clear;
    sql.text:='select * from your_table';
    open;
      savetofile('fdsafd');//悲愤了
    end;//还原
    with adoquery1 do
    begin
      loadfromfile('fdsafd');
      if active then
      begin
        while not eof do
        begin
          //用 insert into 一条条插进去吧
         //或者用个adoquery打开access中的表循环复制
        end;
    end;
    end;
      

  2.   

    可以这样备份access数据库:用到ini文件function TSystem.Sjbf(const TargetDir: ShortString): Boolean;
    var
      ExistsFileName: string;
    begin
      Result := True;
      with TIniFile.Create(WorkPath + 'infor.ini') do
        try
          try
            ExistsFileName := ReadString('section', 'DBConnection', '');
            CopyFile(PChar(ExistsFileName), PChar(TargetDir
              + ExtractFileName(ExistsFileName)), True);
            except
            Result := False;
          end;
        finally
          Free;
        end;end;
      

  3.   

    哦,看错了,备份的是表啊?哦,一样的,关键都是用copyfile()这个函数。
      

  4.   

    在目标数据库里建立一个相同的表,然后在原数据库里建立一链接表,用sql写:adoquery1.SQL.Add('insert into 2000table(name,sex,zhengzhi,beizhu) select name,sex,zhengzhi,beizhu from table1');
    2000table:目标数据库里相同的表table:是原表