03 April 2011

Form Login Delphi with Oracle

unit login;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Mask, DBCtrls;
type
  TFormlogin = class(TForm)
    Panel1: TPanel;
    Button1: TButton;
    Button2: TButton;
    GroupBox1: TGroupBox;
    Labelnama: TLabel;
    Labelkata: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;

    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
      private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Formlogin: TFormlogin;
implementation
uses home, dmconn;
{$R *.dfm}

procedure TFormlogin.Button2Click(Sender: TObject);
begin
application.Terminate;
end;

procedure TFormlogin.Button1Click(Sender: TObject);
begin
 with dm.QTemp do begin
    Close;
    SQL.Clear;
    SQL.Add('select * from pengguna where nama_pengguna='+
    QuotedStr(edit1.Text));
    Open;
  end;
  if dm.ADOQuerypengguna.RecordCount = 0 then
      Application.MessageBox('Maaf Nama Pengguna Tersebut Tidak Ada', 'Informasi',
      MB_OK or MB_ICONINFORMATION)
  else begin
    if dm.ADOQuerypengguna.FieldByName('kata_kunci').AsString <> edit2.Text
      then Application.MessageBox('Pastikan Nama Pengguna atau Kata Kunci Anda Benar', 'Error',
      MB_OK or MB_ICONERROR)
  else begin
    Hide;
    Application.CreateForm(TFormhome,Formhome);
    formhome.ShowModal;
    close;
  end;
  end;
end;

end.
Share:

0 komentar:

Post a Comment

Blog Archive