delphi + mysql do library management system, how the mysql database package also go in together? I use the delphi Express components.

sqlconnection, sqlquery1 these components, when I connect to the database is linked with the object editor attributes specified in sqlconnection character set utf8, a method some people to do is to use the database code to connect, if I connect with the code mysql how database do? ? Use sqlconnecion connect to the database. Clearly point then is how to achieve connection with the code mysql database, and specify the character set utf8 (not to do so would garbled).

2011-05-04 11:24 questioner adopted
1, download this file http://www.justsoftwaresolutions.co.uk/files/dbxopenmysql5_dll.zip
and antidote inside delphi dll file to the bin directory
is typically: C: \ Program files \ the Borland \ Delphi6 Delphi7 \ the Bin
2:
modify dbxconnections.ini file
is typically: C: \ Program files \ Common files \ Borland Shared \ DBExpress \ dbxconnections.ini
in dbxconnections.ini rearmost plus (note that the first two line)
[MySQL5Connection]
the DriverName = MySQL5
the HostName = 127.0.0.1
Database = News
User_Name = the root
Password = the root
BlobSize = -1
ErrorResourceFile =
localeCode = 0000

Dbxdrivers.ini modified file
is typically: C: \ Program Files \ Common Files \ Borland Shared \ DBExpress \ dbxdrivers.ini
in dbxdrivers.ini rearmost plus (note that the first three lines)
[MySQL5]
and GetDriverFunc = getSQLDriverMYSQL
the LibraryName = dbxopenmysql50.dll
= libmysql.dll VendorLib is
the HostName = ServerName
Database = DBNAME
User_Name = User
password = password
BlobSize = -1
ErrorResourceFile =
localeCode = 0000

3, and add a new project Tsqlconnection component selecting means selects MySQL5Connection (i.e. dbxconnections.ini modified file [] middle name) connectionName in the properties window and then connected to the true input in the dialog box for the user name and If the password is correct then the database is connected
To modify the mysql address can be modified in the component properties in params Tsqlconnection

If you want to set a window into the FromCreate can double-click inside the window event add the following code in the project in
Connection: = TSQLConnection.Create (nil);
Connection.DriverName: = 'dbxmysql';
Connection.GetDriverFunc: = 'getSQLDriverMYSQL50'; // main line
Connection.LibraryName: = 'dbxopenmysql50.dll'; // this line is mainly
Connection.VendorLib: = 'libmysql.dll';
Connection.Params.Append ( 'Database = NAME_OF_DATABASE);
Connection.Params.Append (' User_Name NAME_OF_USER = ');
Connection.Params.Append (' Password = PASSWORD ');
Connection.Params.Append (' the HostName = localhost ');

If not able to find libmysql.dll should copylibmysql.dll file to the directory or under delphi project files to mysql directory
questioning
Thank you for your answer, if I want to connect mysql database with the way the code of how to do?
Answer
I added later
is modify the properties of the component Tsqlconnection it actually achieved in the project file
after you select ([] middle name that is dbxconnections.ini file modified) MySQL5Connection connectionName in the Properties window, and then view its properties you can modify in the project file

Guess you like

Origin www.cnblogs.com/blogpro/p/11456897.html