| |

VerySource

 Forgot password?
 Register
Search
View: 24|Reply: 3

How to backup and restore the ACCESS database

[Copy link]

1

Threads

2

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

Post time: 2020-2-13 09:30:02
| Show all posts |Read mode
Dear brothers and sisters,
I have an ACCESS database, and now I want to implement its backup and restore, the specific situation is as follows:
(I am very good, please enlighten me in detail, it is best to have code, thank you!)

Source database path
d:\bd\data.mdb
Path you want to backup to
e:\backup


Please enlighten me, thank you! !! !!
Reply

Use magic Report

0

Threads

20

Posts

12

Credits

Newbie

Rank: 1

Credits
12

 China

Post time: 2020-4-11 11:30:01
| Show all posts
Just copy and paste.
Reply

Use magic Report

1

Threads

2

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

 Author| Post time: 2020-4-28 10:30:02
| Show all posts
It is required that there are two buttons in the management interface: "backup" and "download", to achieve the functional requirements in one click, and beg for code!
Reply

Use magic Report

0

Threads

1

Posts

2

Credits

Newbie

Rank: 1

Credits
2

 China

Post time: 2020-4-28 19:15:01
| Show all posts
I just wrote it and sent it to you, it works, language: delphi
Backup:
var
path: string; // The variable that stores the backup path
begin
 path: = trim (ExtractFilePath (Application.ExeName)) + 'Database backup\' + 'db2.mdb';
  try
 if path <> '' then
  begin
    copyfile (pchar ('db1.mdb'), pchar (path), true);
    application.MessageBox (pchar ('Backup successful!' + # 13), 'XGY', mb_ok + mb_iconinformation);
  end;
except
  begin
    application.MessageBox (pchar ('Backup failed!' + # 13), 'XGY', mb_ok + mb_iconwarning);
    abort;
  end;

reduction:
var
  dbname, dbbname: string;

begin
    if MessageBox (self.Handle, 'Are you sure you want to restore the data?', 'Prompt', mb_IconQuestion + mb_YesNo) = idYes then
  begin

   dbname: = ExtractFilePath (Application.ExeName) + 'Database backup\' + 'db2.mdb';
   dbbname: = ExtractFilePath (Application.ExeName) + 'New folder\' + 'db1.mdb';
    if not FileExists (dbname) then
      MessageBox (self.Handle, 'No backup data, cannot be restored', 'Prompt', mb_IconInformation + mb_Ok)
    else
    begin
      CopyFile (Pchar (dbname), Pchar (dbbname), true);
      MessageBox (handle, 'Database restored successfully!', 'Prompt', mb_IconInformation + mb_Ok);
    end;
  end;

end;
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list