var
SQLConnection1: TSQLConnection;
begin
SQLConnection1 := TSQLConnection.Create(nil);
SQLConnection1.LoginPrompt := False;
SQLConnection1.Params.Clear;
SQLConnection1.Params.Add('DriverName=MySQL');
SQLConnection1.ConnectionName := 'MySQLConnection';
SQLConnection1.Params.Add('HostName=localhost');
SQLConnection1.Params.Add('Database=test');
SQLConnection1.Params.Add('User_Name=root');
SQLConnection1.Params.Add('Password='); SQLConnection1.Connected := True; if SQLConnection1.Connected then
ShowMessage('连接成功!')
else
ShowMessage('连接失败!');
SQLConnection1.Free;
SQLConnection1: TSQLConnection;
begin
SQLConnection1 := TSQLConnection.Create(nil);
SQLConnection1.LoginPrompt := False;
SQLConnection1.Params.Clear;
SQLConnection1.Params.Add('DriverName=MySQL');
SQLConnection1.ConnectionName := 'MySQLConnection';
SQLConnection1.Params.Add('HostName=localhost');
SQLConnection1.Params.Add('Database=test');
SQLConnection1.Params.Add('User_Name=root');
SQLConnection1.Params.Add('Password='); SQLConnection1.Connected := True; if SQLConnection1.Connected then
ShowMessage('连接成功!')
else
ShowMessage('连接失败!');
SQLConnection1.Free;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货