program Project1;mysql
{$APPTYPE CONSOLE}sql
{$R *.res}code
uses
System.SysUtils,data.DB, data.DBXCommon,classes, data.sqlexpr,vcl.dialogs,
Data.DBXMySQL;
var
fsqlconn:Tsqlconnection;
beginit
try
{ TODO -oUser -cConsole Main : Insert code here }
fsqlconn:=TsqlConnection.Create(nil);io
fsqlconn.ConnectionName:='MYSQLCONNECTION';
fsqlConn.DriverName:='MySQL';
fsqlConn.LoginPrompt:=false;
fsqlconn.Params.Clear;class
fsqlConn.Params.Add('VendorLib=F:\soft\database\mysql\LIBMYSQL.dll');
fsqlconn.Params.Add('ServerCharSet=utf8');
fsqlconn.Params.Add('HostName=localhost');
fsqlconn.Params.Add('Database=lzf');
fsqlConn.Params.Add('User_Name=lzf');
fsqlConn.Params.Add('Password=123456');
fsqlconn.Params.Add('Compressed=False');
fsqlconn.Params.Add('Encrypted=False');sed
fsqlConn.Open;
showmessage('Good');
fsqlConn.Close;
except
on E: Exception do
begin
Writeln(E.ClassName, ': ', E.Message);
showmessage(e.Message);
fsqlconn.Free;
end;
end;word
end.tab
xe2和xe5的惟一區別是:
fsqlconn.VendorLib:='F:\soft\database\mysql\libmysql.dll';
有點很差的是,好像仍是隻能支持5.1.63左右的libmysql.dlldi
也有人說 是 libmysql.dll 版本問題