我用的是Access的数据库。主要代码如下:
var
  i: integer;
begin
  try
    if not savedialog1.Execute then exit;
    if FileExists(savedialog1.FileName+'.mdb') then
    begin
      if Messagebox(handle,'存在数据库重名,是否覆盖?','存盘选项',mb_iconquestion+mb_yesno)=IDNo then Exit;
    end
    else
    begin
      for i:=Gauge1.MinValue to Gauge1.MaxValue do
        Gauge1.Progress := i;
      CopyFile(PChar(DataFile),PChar(SaveDialog1.FileName+'.mdb'),True);
      Messagebox(handle,'数据库备份成功!','备份数据',mb_iconinformation+mb_ok);
    end;
  except
    Messagebox(handle,'警告:数据库备份失败!','存盘错误',mb_iconwarning+mb_ok);
  end;
end;下面的这段是对dataFile的设定:
ChDir(ExtractFilePath(Application.ExeName));
  ChDir('..');
  ExeRoot:= GetCurrentDir;
  DataFile:= GetCurrentDir+'\data\Prodata.mdb';我遇到的问题是,为什么我总是保存不下来数据库。程序能够很好的执行,但是就是没东西。郁闷!
请各位高手指教!