Create User Interface or Application for HIS - First step : Connecting to DBMS

In this article we talk about application software that used by user to access to the hospital information system. For practical purpose, we require Delphi 7, MySQL for Windows, and ODBC Driver for MySQL.
Some example of how to connect to and query an MySQL database using Delphi 7 :
  • You could use ZeosLib freeware components in http://sourceforge.net/projects/zeoslib/
  • MySQL has a ODBC Connector that allows you to use ADO components to connect and query the database! Here is the information: http://www.devarticles.com/c/a/Delph...hi-with-MySQL/
1. Create data module form to manage database components of your project, give a name such as frmMyData.
2. On the data module form, put an ADOConnection component, give it a name such as myConn.
3. In ConnectionString properties field of myConn, type this:
Provider=MSDASQL.1;Password=somepassword;Extended Properties="DRIVER={MySQL ODBC 5.1 Driver};PWD=somepassword;SERVER=servername;PORT=3306;DATABASE=somedbname;USER=root;OPTION=3;"
4. In LoginPrompt field of myConn choose False.
5. Then we can use myConn to fill Connection properties field of ADOTable, ADOStoredProc or other ADO components in frmMyData data module form.
 

0 comments:

Post a Comment