Selasa, 29 Januari 2019

coding Membuat From Login Database Mysql Delphi7





unit Login;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Buttons, StdCtrls, ZConnection, DB, ZAbstractRODataset,
  ZAbstractDataset, ZDataset, sSkinManager;

type
  TLogin_DataBase = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Button2: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    BitBtn1: TBitBtn;
    ZQuery1: TZQuery;
    ZConnection1: TZConnection;
    sSkinManager1: TsSkinManager;
    procedure BitBtn1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Login_DataBase: TLogin_DataBase;

implementation

uses menu;

{$R *.dfm}

procedure TLogin_DataBase.BitBtn1Click(Sender: TObject);
begin
//Login
with ZQuery1 do
begin
SQL.Clear;
SQL.Add('select * from login where username='+QuotedStr(Edit1.Text));
Open;
End;

//jika tidak ditemukan maka muncul pesan dibawah ini

if ZQuery1.RecordCount=0 then
Application.MessageBox('Maaf User name yang kalian masukan itu salah pintar!!!','informasi',MB_OK or MB_ICONINFORMATION)
else
begin
if ZQuery1.FieldByName('password').AsString <> Edit2.Text then
Application.MessageBox('silakan cek password anda dengan benar bodoh!!!','error',MB_OK or MB_ICONERROR)else
begin
Hide;
welcome.Show;
MessageDlg('anda berhasil login',mtInformation,[mbOK],0);
end;
end;
end;





procedure TLogin_DataBase.Button2Click(Sender: TObject);
var Tanya:Integer;
begin

//Keluar dari aplikasih
Tanya:=Application.MessageBox('apah anda yakin ingin keluar','confirmation',MB_YESNO + MB_ICONQUESTION);
if Tanya = 6 then
Application.Terminate;
end;


Vidio :

Tidak ada komentar:

Posting Komentar