Advertisement
Guest User

error run

a guest
Feb 16th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.31 KB | None | 0 0
  1. procedure TFmenu.FormShow(Sender: TObject);
  2. var
  3.   myform: Tfconection;
  4.   FileIni: TIniFile;
  5. begin
  6.  
  7.   FileIni := TIniFile.Create(Extractfilepath(Application.exename) + 'Setup.ini');
  8.   // Cek Koneksi
  9.   try
  10.     try
  11.       with ZConnectiondb do
  12.       begin
  13.         ZConnectiondb.Connected := False;
  14.         // Baca data Koneksi dari file ini
  15.         ZConnectiondb.Database := FileIni.ReadString('Connection', 'Database', '');
  16.         ZConnectiondb.Hostname := FileIni.ReadString('Connection', 'Hostname', '');
  17.         ZConnectiondb.LibraryLocation := Extractfilepath(Application.exename) + FileIni.ReadString('Connection', 'Library', '');
  18.         ZConnectiondb.Password := FileIni.ReadString('Connection', 'password', '');
  19.         ZConnectiondb.Port := FileIni.ReadInteger('Connection', 'Port', 0);
  20.         ZConnectiondb.Protocol := FileIni.ReadString('Connection', 'Protocol', '');
  21.         ZConnectiondb.User := FileIni.ReadString('Connection', 'User', '');
  22.         ZConnectiondb.Connected := True;
  23.  
  24.         // Set Koneksi Komponen yang berhubungan dengan database
  25.       end;
  26.     except
  27.       ShowMessage('Koneksi ke Database Gagal' + chr(10) + ' ' + 'Silahkan Setting Ulang...');
  28.       myform := TFconection.Create(nil);
  29.       myform.Showmodal;
  30.     end;
  31.   finally
  32.     FileIni.Free;
  33.   end;
  34.   // End Cek
  35. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement