Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- Blog : delphianimelover.blogspot.com
- Fanpage FB : https://www.facebook.com/jean.software
- FB Programmer: https://www.facebook.com/jean.software
- Telegram : @Yamiriko
- WA Only : 087790319305
- BBM : 54B5758E
- Butuh VPS Storage atau VPS Biasa untuk web, database online, upload download,
- Torrent leech dan seed private server, mining $$$ ?
- Cek ditoko ya : https://www.facebook.com/jean.software/shop/
- Rekber FJB Kaskus : http://www.kaskus.co.id/profile/viewallclassified/8956970
- }
- unit UCRUD_SQLLite;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, Grids, DBGrids, ComCtrls, DB, MemDS, DBAccess, Uni,
- UniProvider, SQLiteUniProvider;
- type
- TFCrudSQLite = class(TForm)
- Label1: TLabel;
- Label2: TLabel;
- EdKode: TEdit;
- EdNama: TEdit;
- DBGrid1: TDBGrid;
- BtnSimpan: TButton;
- BtnUbah: TButton;
- BtnHapus: TButton;
- BtnBatal: TButton;
- StatusBar1: TStatusBar;
- cn: TUniConnection;
- Q_Temp: TUniQuery;
- TampilData: TUniQuery;
- DS: TUniDataSource;
- SQLiteUniProvider1: TSQLiteUniProvider;
- procedure FormShow(Sender: TObject);
- procedure BtnSimpanClick(Sender: TObject);
- procedure BtnUbahClick(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure BtnBatalClick(Sender: TObject);
- procedure DBGrid1CellClick(Column: TColumn);
- procedure EdKodeExit(Sender: TObject);
- procedure BtnHapusClick(Sender: TObject);
- private
- { Private declarations }
- procedure bersih;
- procedure openDB;
- procedure tampil;
- procedure Awal;
- procedure Proses;
- public
- { Public declarations }
- end;
- var
- FCrudSQLite: TFCrudSQLite;
- implementation
- {$R *.dfm}
- procedure TFCrudSQLite.bersih;
- begin
- EdKode.Clear;
- EdNama.Clear;
- EdKode.SetFocus;
- end;
- procedure TFCrudSQLite.openDB;
- begin
- with cn do begin
- AutoCommit:=True;
- LoginPrompt:=False;
- //Skrip untuk mencari otomatis filenya berada dalam 1 folder file exenya
- Database:=ExtractFilePath(Application.EXEName) + 'dB_barang.db3';
- //Akhir scrip
- ProviderName:='SQLite';
- Connected:=True;
- end;
- end;
- procedure TFCrudSQLite.tampil;
- begin
- with TampilData do begin
- Close;
- Active:=False;
- SQL.Clear;
- SQL.Add('SELECT * FROM tb_barang ');
- SQL.Add('ORDER BY kodebarang');
- Active:=True;
- end;
- end;
- procedure TFCrudSQLite.Awal;
- begin
- BtnSimpan.Enabled:=True;
- BtnUbah.Enabled:=False;
- BtnHapus.Enabled:=False;
- BtnBatal.Enabled:=True;
- end;
- procedure TFCrudSQLite.Proses;
- begin
- BtnSimpan.Enabled:=False;
- BtnUbah.Enabled:=True;
- BtnHapus.Enabled:=True;
- BtnBatal.Enabled:=True;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement