This article tells the Delphi remote connection MySQL realization method, is the Delphi database design very important skill. Share for everyone to use for reference. The specific methods are as follows:
Delphi via adoconnection link remote MySQL database, to install software on the computer installed MySQL driver, no in Baidu download, search MySQL ODBC driver came out
The main link code is as follows:
var srstring:string;
Srstring:= ' Driver={mysql ODBC 3.51 DRIVER}; Server= ' +trim (SERVER. Text) + ';D atabase= ' +trim (DATABASE. Text) + '; User= ' +trim (USER. Text) + '; Password= ' +trim (PASSWORD. Text) + '; option= ' +trim OPTION. Text) + '; charset=gb2312; ';
Here is a description of the variable meaning above:
Driver= represents the driver name used,
Server= represents the MySQL database address , remote directly write remote IP
Database= represents the name of the database to which you want to link
user= Database user name
password= Database Password
option= represents Port
Charset= represents the character encoding used
Link Data start:
adoconnection1.connectionstring:=srstring;
Adoconnection1.close;
Adoconnection1.open;
ShowMessage (' Save and Login Database success! ');
Finally, add the ADOConnection control to the form.
I hope this article on the Delphi Database program design help.