Delphi via adoconnection link remote MySQL database, to install the software on the computer installed MySQL driver, not 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; ';
Explain the variable meaning above
Driver= indicates the name of the drive used,
server= represents the MySQL database address, remote direct write remote IP
Database= indicates the name of the database you want to link to
user= Database user Name
password= Database Password
Option= indicates the port
Charset= indicates the character encoding used
Link Data start
adoconnection1.connectionstring:=srstring;
Adoconnection1.close;
Adoconnection1.open;
ShowMessage (' Save and Login Database success! ');
Finally, the record is added to the form with the adoconnection control
Delphi remote connection MySQL