01-02-2023, 01:30 PM
قم بالبحث على التعليمة connection string تختلف حسب قاعدة البيانات المستعملة و المكون المستعمل
مثل SQLServer مع المكون FireDac
procedure TForm2.Button1Click(Sender: TObject);
begin
try
FMSSQLDriverLink := TFDPhysMSSQLDriverLink.Create(nil);
FDBConnection := TFDConnection.Create(nil);
FDBConnection.Params.DriverID := 'MSSQL';
FDBConnection.Params.UserName := 'sa';
FDBConnection.Params.Password := '<your_password>';
FDBConnection.Params.Database := '<your_database>';
FDBConnection.Params.Add('server=<your_DB_server>');
FDBConnection.Connected := True;
if FDBConnection.Connected then begin
ShowMessage('Connected successfully');
end;
finally
if FDBConnection.Connected then begin
FDBConnection.Close;
end;
end;
end;
مثل SQLServer مع المكون FireDac
procedure TForm2.Button1Click(Sender: TObject);
begin
try
FMSSQLDriverLink := TFDPhysMSSQLDriverLink.Create(nil);
FDBConnection := TFDConnection.Create(nil);
FDBConnection.Params.DriverID := 'MSSQL';
FDBConnection.Params.UserName := 'sa';
FDBConnection.Params.Password := '<your_password>';
FDBConnection.Params.Database := '<your_database>';
FDBConnection.Params.Add('server=<your_DB_server>');
FDBConnection.Connected := True;
if FDBConnection.Connected then begin
ShowMessage('Connected successfully');
end;
finally
if FDBConnection.Connected then begin
FDBConnection.Close;
end;
end;
end;
وقل ربي زدني علماً


![[-]](https://delphi4arab.net/forum/D4A2020/collapse.png)