4zmy

Back Up & Restore

Jul 14th, 2014
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.14 KB | None | 0 0
  1. //script Back up
  2. if MessageDlg('Yakin Ingin BackUp Data..??',mtConfirmation,[mbYes]+[mbno],0)=mryes then
  3.   begin
  4.   SaveDialog1.Execute;
  5.   if SaveDialog1.FileName<>'' then
  6.   begin
  7.     ShellExecute(Self.Handle, PChar('open'),
  8.     PChar('C:\xampp\mysql\bin\mysqldump.exe'),
  9.     PChar('-uroot  -hlocalhost -R -r "'+ SaveDialog1.FileName+'.sql" db_apotik'),
  10.     PChar('C:\xampp\mysql\bin'),SW_SHOW);
  11.     MessageDlg('Data Berhasil Dibackup',mtInformation,[mbOK],0);
  12.     end
  13.     else
  14.     MessageDlg('Data gagal Dibackup',mtInformation,[mbOK],0);
  15.   end;
  16.  
  17. //script restore
  18. if MessageDlg('Yakin Ingin Restore Data..??',mtConfirmation,[mbYes]+[mbno],0)=mryes then
  19.   begin
  20.   OpenDialog1.Execute;
  21.   if OpenDialog1.FileName<>'' then
  22.   begin
  23.     ShellExecute(Self.Handle,PChar('open'),
  24.     PChar('C:\xampp\mysql\bin\mysql.exe'),
  25.     PCHAR('-uroot  -hlocalhost -e "drop database if exists db_apotik; '+
  26.   'create database db_apotik; use db_apotik;\. '+OpenDialog1.FileName+'"'),nil,SW_HIDE);
  27.   MessageDlg('Data Berhasil di Restore !!', mtInformation, [mbOK], 0);
  28.   end
  29. else
  30.   MessageDlg('GAGAL. Harap Pilih Lokasi !!!', mtInformation, [mbOK], 0);
  31. end;
Advertisement
Add Comment
Please, Sign In to add comment