one move can make a big change
In the last post, i show you how to Install. Now i wanna try to show you “How make connection to MySql with this Component.
1.Run Your Delphi Application
2.In Component Pallete find Zeos Access ( you can use left arrow and right arrow to navigate this )
3.Drag and drop component
—> Choose Zconnection:TZConnection, you can named this component as you like, ex: MyConn
Ok! for use the component and drop to your Form Design has finish.
Now for next step
1.Click twice your Form Design, you will find
procedure TForm1.FormCreate(Sender: TObject); [type or paste the code here] end.
Insert this code in [type or paste the code here]
ShortDateFormat:='dd/mm/yyyy';
DecimalSeparator:='.';
myConn.Protocol:='mysql';
myConn.HostName:='localhost';
myConn.Port:=StrToInt('3306');
myConn.User:='[your user name to login MySql, default is root]';
myConn.Password:='[your password, but if you uses Zeos you must empty you password to login MySql]';
myConn.Database:='[your database]';
try
myConn.Connect;
except on E:exception do
begin
MessageDlg('Koneksi database gagal!!!'#13+E.Message, mtError,[mbOk],1);
Close;
end;
end;
end;
Save your project, and put libmysql40.dll[default included in your Zeos Package] in directory which contain your .exe file. Now compile your application or push F9.
Popularity: 62%
This is a Erwin Nassa Blog. Writen, Opinion , and Expression. Enjoy my blog and thank's for your comment and coming.
SyamSyah
Indonesia
Mozilla Firefox 2.0.0.13 on
Ubuntu Linux
Posted from :
Using
24 May, 2008 at 2:14 pm
Delphier juga nihh… banyak2 posting delphi yaa… aq mo blajar ma yg udah ahli
thevemo™
Indonesia
Internet Explorer 7.0 on
Windows XP
Posted from :
Using
27 May, 2008 at 11:53 am
saya masih amatir mas…gimana kalo saya yang belajar linux