APLIKASI SEDERHANA BERBASIS DB, ADODB, Grids, DBGrids, DBTables (Delphi 7)

//*BINA SARANA INFORMATIKA*//
//*Coding By Lhourens R.L*//
//*Target Tables,DBGrib*//
------------------------------------------------------------------------------------------



unit F_Mobil;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, ADODB, Grids, DBGrids, DBTables, Buttons,
  ExtCtrls, DBCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    DBGrid1: TDBGrid;
    DataSource1: TDataSource;
    ekd: TEdit;
    Label3: TLabel;
    enm: TEdit;
    eno: TEdit;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    rs: TRadioButton;
    rk: TRadioButton;
    rsd: TRadioButton;
    bt: TBitBtn;
    bs: TBitBtn;
    be: TBitBtn;
    bb: TBitBtn;
    bkeluar: TBitBtn;
    ecari: TEdit;
    Label7: TLabel;
    bcari: TBitBtn;
    Table1: TTable;
    em: TEdit;
    Label8: TLabel;
    DBNavigator1: TDBNavigator;
    procedure FormActivate(Sender: TObject);
    procedure btClick(Sender: TObject);
    procedure bsClick(Sender: TObject);
    procedure beClick(Sender: TObject);
    procedure bcariClick(Sender: TObject);
    procedure bbClick(Sender: TObject);
    procedure bkeluarClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  a:boolean;
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormActivate(Sender: TObject);
begin
ekd.Text:=table1['IdMobil'];
enm.Text:=table1['Nm'];
eno.Text:=table1['Nopol'];

if table1['Jenis']='Sport' then
    rs.Checked:=true
else if table1['Jenis']='Keluarga' then
    rk.Checked:=true
else
    rsd.Checked:=true;

em.Text:=table1['Merk'];
ekd.Enabled:=false;
enm.Enabled:=false;
eno.Enabled:=false;
rs.Enabled:=false;
rk.Enabled:=false;
rsd.Enabled:=false;
em.Enabled:=false;
bs.Enabled:=false;
bb.Enabled:=false;
be.Enabled:=false;
end;

procedure TForm1.btClick(Sender: TObject);
begin
a:=true;
ekd.Text:='';
enm.Text:='';
eno.Text:='';
em.Text:='';
rs.Checked:=false;
rk.Checked:=false;
rsd.Checked:=false;
ekd.Enabled:=true;
enm.Enabled:=true;
eno.Enabled:=true;
rs.Enabled:=true;
rk.Enabled:=true;
rsd.Enabled:=true;
em.Enabled:=true;
bs.Enabled:=true;
bb.Enabled:=true;
be.Enabled:=true;
ekd.SetFocus;
end;

procedure TForm1.bsClick(Sender: TObject);
begin
if a=true then
   table1.Append
else
    table1.Edit;


table1['IdMobil']:=ekd.Text;
table1['Nm']:=enm.Text;
table1['Nopol']:=eno.Text;
if rs.Checked=true then
   table1['Jenis']:='Sport'
else if rk.Checked=true then
        table1['Jenis']:='Keluarga'
else
    table1['Jenis']:='Sedan';

table1['Merk']:=em.Text;
table1.Post;
ekd.Enabled:=false;
enm.Enabled:=false;
eno.Enabled:=false;
rs.Enabled:=false;
rk.Enabled:=false;
rsd.Enabled:=false;
em.Enabled:=false;
end;

procedure TForm1.beClick(Sender: TObject);
begin
a:=false;
ekd.Enabled:=false;
enm.Enabled:=true;
eno.Enabled:=true;
rs.Enabled:=true;
rk.Enabled:=true;
rsd.Enabled:=true;
em.Enabled:=true;
end;

procedure TForm1.bcariClick(Sender: TObject);
begin
if table1.Locate('IdMobil',ecari.Text,[]) then
   begin
   ekd.Text:=table1['IdMobil'];
   enm.Text:=table1['Nm'];
   eno.Text:=table1['Nopol'];
   if table1['Jenis']='Sport' then
   rs.Checked:=true
   else if table1['Jenis']='Keluarga' then
   rk.Checked:=true
   else
   rsd.Checked:=true;

em.Text:=table1['Merk'];
end
else
showmessage('Id Mobil Tidak Ditemukan');
ecari.Clear;
ecari.SetFocus;
end;

procedure TForm1.bbClick(Sender: TObject);
var a,b:integer;
begin
if table1.RecordCount > 0 then
    begin
    a:=table1.RecordCount;
    for b:=1 to a do
    begin
    table1.Delete;
    table1.Next;
    end;
table1.Refresh;
end;
eno.Text:='';
enm.Text:='';
ekd.Text:='';
em.Text:='';
bt.Enabled:=true;
bs.Enabled:=true;
be.Enabled:=true;
end;

procedure TForm1.bkeluarClick(Sender: TObject);
begin
if (application.MessageBox('Apakah Anda Mau Keluar Dosen Pemeriksa','EXIT',mb_yesno)=idyes) then
    close;
end;

end.




Screen Shut Program Sebagai Berikut :





Sekian Dan Terima Kasih....

Posting Komentar

Please Select Embedded Mode To Show The Comment System.*

Lebih baru Lebih lama