D2 TEKNIK KOMPUTER (BSI PROGRAMMER)
Langsung aja, Mari kita lihat dengan seksama cara koneksi dari File SQL yang dibuat dari PHPAdmin (XAMPP) ke Form Delphi 2010...
1. Koneksi ODBC
2. Buat SQL dengan PHPAdmin
3. DataSource ODBC
4. Koneksi Dan Pilih Sesuai dengan Tujuan
5. Koneksi Dengan ADOTable dengan Delphi 2010
Tampilan Report
Tampilan Program ScreenShut
Listing Program untuk aplikasi sederhana buku tamu ini, dapat kita lihat dengan seksama.....
Silahkan disimak dan diulas menurut kepintaran anda<{}>.
(a). DataBase_.pas
unit DataBase_;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, DB, DBClient, ExtCtrls, DBCtrls, DBTables, ADODB,
StdCtrls, Mask, Menus, AccessXP, OleServer, OutlookXP, jpeg, Buttons,
PeriodeBulanTahun, ZConnection, QuickRpt, QRCtrls;
type
TFormUtama = class(TForm)
Panel1: TPanel;
dbgEmployee: TDBGrid;
Panel2: TPanel;
dsEmployee: TDataSource;
ADOTable1: TADOTable;
Panel3: TPanel;
Memo1: TMemo;
Panel4: TPanel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
DBEdit1: TDBEdit;
DbCombobox1: TDBComboBox;
DBEdit2: TDBEdit;
DBMemo1: TDBMemo;
Label4: TLabel;
MainMenu1: TMainMenu;
File1: TMenuItem;
Exit1: TMenuItem;
Help1: TMenuItem;
AboutMe1: TMenuItem;
PopupMenu1: TPopupMenu;
Refresh1: TMenuItem;
Exit2: TMenuItem;
Label6: TLabel;
DBEdit3: TDBEdit;
Timer1: TTimer;
Label9: TLabel;
DBComboBox2: TDBComboBox;
Label10: TLabel;
DBEdit4: TDBEdit;
Label11: TLabel;
DBEdit5: TDBEdit;
Label12: TLabel;
DBEdit6: TDBEdit;
Label5: TLabel;
DBNavigator1: TDBNavigator;
Image1: TImage;
PeriodeBulanTahun1: TPeriodeBulanTahun;
Edit1: TEdit;
Edit2: TEdit;
ools1: TMenuItem;
ClearHapusDataSemuanya1: TMenuItem;
MusicPlayer: TMenuItem;
Edit3: TEdit;
Label7: TLabel;
Button1: TButton;
Edit4: TEdit;
Label8: TLabel;
AplikasiDownload1: TMenuItem;
ControlDataBasePHPAdminTamu11: TMenuItem;
Print2: TMenuItem;
QRSysData1: TQRSysData;
procedure AboutMe1Click(Sender: TObject);
procedure Exit1Click(Sender: TObject);
procedure Refresh1Click(Sender: TObject);
procedure Exit2Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure DBComboBox2Change(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Timer1Timer(Sender: TObject);
procedure ClearHapusDataSemuanya1Click(Sender: TObject);
procedure MusicPlayerClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure AplikasiDownload1Click(Sender: TObject);
procedure ControlDataBasePHPAdminTamu11Click(Sender: TObject);
procedure Print2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormUtama: TFormUtama;
implementation
uses DataBase_Form2, DataBase_Form3,MusicPlayer_Apple2,Downloader,DataBase_Form4,DataBase_Form5;
{$R *.dfm}
procedure TFormUtama.AboutMe1Click(Sender: TObject);
begin
AboutMe.Show;
end;
procedure TFormUtama.AplikasiDownload1Click(Sender: TObject);
begin
Apps_Download.Show;
end;
procedure TFormUtama.Button1Click(Sender: TObject);
begin
PeriodeBulanTahun1.Month:=StrtoInt(Edit3.Text);
PeriodeBulanTahun1.Year:=Strtoint(Edit4.Text);
end;
procedure TFormUtama.ClearHapusDataSemuanya1Click(Sender: TObject);
begin
Form3.Show;
end;
procedure TFormUtama.ControlDataBasePHPAdminTamu11Click(Sender: TObject);
begin
Navigator.Show;
end;
procedure TFormUtama.DBComboBox2Change(Sender: TObject);
begin
If DBComboBox2.ItemIndex = 0 Then
Begin
DBEdit4.Visible := True;
DBEdit4.Enabled := True;
Label10.Visible := True;
Label10.Enabled := True;
End
Else If DBComboBox2.ItemIndex = 1 Then
Begin
DBEdit4.Visible := True;
DBEdit4.Enabled := True;
Label10.Visible := True;
Label10.Enabled := True;
End
Else If DBComboBox2.ItemIndex = 2 Then
Begin
DBEdit4.Visible := False;
DBEdit4.Enabled := False;
Label10.Visible := False;
Label10.Enabled := False;
End;
end;
procedure TFormUtama.Exit1Click(Sender: TObject);
begin
Application.Terminate;
end;
procedure TFormUtama.Exit2Click(Sender: TObject);
begin
Application.Terminate;
end;
procedure TFormUtama.FormActivate(Sender: TObject);
begin
Edit1.Text:=Formatdatetime('dd mmmm yyyy',Date);
DBEdit1.Text := ' ';
DBEdit4.Visible := False;
DBEdit4.Enabled := False;
Label10.Visible := False;
Label10.Enabled := False;
end;
procedure TFormUtama.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Application.Terminate;
end;
procedure TFormUtama.MusicPlayerClick(Sender: TObject);
begin
Form1.show;
end;
procedure TFormUtama.Print2Click(Sender: TObject);
begin
report.QuickRep1.Preview;
end;
procedure TFormUtama.Refresh1Click(Sender: TObject);
begin
dbgEmployee.Refresh;
ADOTable1.Refresh;
end;
procedure TFormUtama.Timer1Timer(Sender: TObject);
begin
Edit2.Text := timetostr(time);
end;
end.
(b). DataBase_Form2
unit DataBase_Form2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls;
type
TAboutMe = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label4: TLabel;
Label9: TLabel;
GroupBox1: TGroupBox;
Label5: TLabel;
Label6: TLabel;
Label10: TLabel;
Image1: TImage;
Label3: TLabel;
procedure FormActivate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
AboutMe: TAboutMe;
implementation
uses DataBase_;
{$R *.dfm}
procedure TAboutMe.FormActivate(Sender: TObject);
begin
FormUtama.Enabled:=False;
end;
procedure TAboutMe.FormClose(Sender: TObject; var Action: TCloseAction);
begin
FormUtama.Enabled:=True;
end;
end.
(c). DataBase_Form3
unit DataBase_Form3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm3 = class(TForm)
GroupBox1: TGroupBox;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
Uses DataBase_;
{$R *.dfm}
procedure TForm3.Button1Click(Sender: TObject);
begin
If Checkbox1.Checked = True Then
Begin
FormUtama.dsEmployee.Free;
FormUtama.dbgEmployee.Free;
CheckBox1.Checked:=false;
End;
if CheckBox2.Checked = True then
Begin
FormUtama.ADOTable1.Edit;
FormUtama.ADOTable1.ClearFields;
FormUtama.ADOTable1.Delete;
CheckBox2.Checked:=false;
End;
Form3.Close;
end;
procedure TForm3.Button2Click(Sender: TObject);
begin
Form3.Close;
end;
end.
(d). Downloader
unit Downloader;
interface
uses
Windows, Messages, Classes, Graphics, Controls, Forms,
SysUtils, StdCtrls, ExtCtrls, IEDownload, ComCtrls;
type
TApps_Download = class(TForm)
Panel1: TPanel;
Button1: TButton;
Panel2: TPanel;
Label1: TLabel;
edtAddress: TEdit;
ProgressBar1: TProgressBar;
memDL: TMemo;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure MyProgress(Sender: TBSCB; ulProgress, ulProgressMax,
ulStatusCode, FileSize: ULONG; szStatusText: LPCWSTR; Downloaded,
ElapsedTime, Speed, RemainingTime, Status, Percent: string);
public
{ Public declarations }
end;
var
Apps_Download: TApps_Download;
implementation
{$R *.dfm}
procedure TApps_Download.Button1Click(Sender: TObject);
var
IED: TIEDownload;
begin
IED := TIEDownload.Create(Self);
try
with IED do
begin
OpenDownloadFolder := True;
OnProgress := MyProgress;
Apps_Download.Caption:= 'Downloading from: ' + edtAddress.Text;
Go(edtAddress.Text);
with memDL.Lines do
begin
Clear;
Add('Downloaded File: ' + DownloadedFile);
Add('Download Folder: ' + DownloadFolder);
Add('File Name: ' + FileName);
Add('Server IP: ' + ServerIP);
Add('Server Address: ' + ServerAddress);
Add('File type: ' + MimeType);
Add('File extension: ' + FileExtension);
Add('File Size: ' + FormatSize(FileSize));
end;
end;
finally
IED.Free;
Apps_Download.Caption := 'Done.';
end;
end;
procedure TApps_Download.MyProgress(Sender: TBSCB; ulProgress, ulProgressMax,
ulStatusCode, FileSize: ULONG; szStatusText: LPCWSTR; Downloaded,
ElapsedTime, Speed, RemainingTime, Status, Percent: string);
begin
ProgressBar1.Max := ulProgressMax;
ProgressBar1.Position := ulProgress;
Label2.Caption := 'Percents: ' + Percent;
end;
end.
(e). MusicPlayer_Apple2
unit MusicPlayer_Apple2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, jpeg, ExtCtrls, MPlayer, StdCtrls, ComCtrls, OleCtrls,
ShockwaveFlashObjects_TLB, Menus,acProgressBar, MMsystem;
type
TForm1 = class(TForm)
MediaPlayer1: TMediaPlayer;
Image1: TImage;
MainMenu1: TMainMenu;
Button1: TButton;
Button2: TButton;
OpenDialog1: TOpenDialog;
File1: TMenuItem;
OpenMp31: TMenuItem;
Exit1: TMenuItem;
ools1: TMenuItem;
ClearPlayList1: TMenuItem;
Help1: TMenuItem;
AboutMe1: TMenuItem;
sProgressBar1: TsProgressBar;
ListBox1: TListBox;
Edit1: TEdit;
Timer1: TTimer;
ShockwaveFlash1: TShockwaveFlash;
procedure Button1Click(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure ListBox1DblClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Exit1Click(Sender: TObject);
procedure OpenMp31Click(Sender: TObject);
procedure ClearPlayList1Click(Sender: TObject);
procedure AboutMe1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.AboutMe1Click(Sender: TObject);
begin
ShowMessage('ABOUT ME : RIDWAN FANGIDAE');
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Shockwaveflash1.Movie:=GetCurrentdir+'\loading6.swf';
Shockwaveflash1.Play;
Shockwaveflash1.Playing:=True;
if Opendialog1.Execute = True then
Begin
ListBox1.Items.AddObject(OpenDialog1.FileName,MediaPlayer1);
MediaPlayer1.FileName:=OpenDialog1.FileName;
MediaPlayer1.Open;
MediaPlayer1.Play;
sProgressBar1.Position:=MediaPlayer1.Position;
sProgressBar1.Max:=MediaPlayer1.Length;
MediaPlayer1.Enabled:=True;
Timer1.Enabled:=True;
End;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ListBox1.Items.Delete(ListBox1.ItemIndex);
end;
procedure TForm1.ClearPlayList1Click(Sender: TObject);
begin
ListBox1.Items.Clear;
end;
procedure TForm1.Exit1Click(Sender: TObject);
begin
Form1.Close;
end;
procedure TForm1.ListBox1Click(Sender: TObject);
Var A:Integer;
begin
A:=ListBox1.ItemIndex;
If ListBox1.Selected[A] Then
Begin
Edit1.Text:=ListBox1.Items.Strings[A];
End;
end;
procedure TForm1.ListBox1DblClick(Sender: TObject);
Var A:Integer;
begin
A:=ListBox1.ItemIndex;
If ListBox1.Selected[A] Then
Begin
Edit1.Text:=ListBox1.Items.Strings[A];
MediaPlayer1.FileName:=Edit1.Text;
MediaPlayer1.Open;
MediaPlayer1.Play;
End;
end;
procedure TForm1.OpenMp31Click(Sender: TObject);
begin
Shockwaveflash1.Movie:=GetCurrentdir+'\loading6.swf';
Shockwaveflash1.Play;
Shockwaveflash1.Playing:=True;
if Opendialog1.Execute = True then
Begin
ListBox1.Items.AddObject(OpenDialog1.FileName,MediaPlayer1);
MediaPlayer1.FileName:=OpenDialog1.FileName;
MediaPlayer1.Open;
MediaPlayer1.Play;
sProgressBar1.Position:=MediaPlayer1.Position;
sProgressBar1.Max:=MediaPlayer1.Length;
MediaPlayer1.Enabled:=True;
Timer1.Enabled:=True;
End;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
sProgressBar1.Position:=MediaPlayer1.Position;
end;
end.
Video Pendukung dari KPPDI