Let try.....
- Make a stand-alone procedure, if still a beginner stage, can be positioned at the top of all the existing syntax
PRIVATE koneksi AS Connection
PUBLIC rst AS Result
This means that connection name that we will create the connection, perhaps for my friends who already know PHP programming, well this procedure a little like php, where we usually make the connection. For example koneksi.php that contains command of connection to the database, but here there is little difference
Public rst as result. rst is name of the result, if you would like to change with another name, no problem
2. Write a command to a database connection into form load. When form load code at first time in the form directly connect to the database
PUBLIC SUB Form_Open() 'event ketika form dibuka/hidup
koneksi = NEW Connection 'nama koneksi yang sudah kita buat diatas
koneksi.Type = "mysql" 'nama database
koneksi.Host = "localhost" 'hostname dari database
koneksi.Login = "root" 'nama user database
koneksi.Password = "gambas" 'password dari database
koneksi.Name = "perpus" 'nama database
koneksi.Open 'koneksi dibuka
end 'akhir perintah
That is the way to connect with a MySQL database from Gambas, easy right?
See you next ditutorial ....
0 comments:
Post a Comment