unit Unit_openADOTable;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.StdCtrls, Data.DB,
Vcl.ExtCtrls,
Vcl.Grids,
Vcl.DBGrids, Data.Win.ADODB;
type
TForm1 =
class(TForm)
ADOTable1: TADOTable;
ADOConnection1: TADOConnection;
DBGrid1: TDBGrid;
Panel1: TPanel;
DataSource1: TDataSource;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var Servername, Databasename, TableName :
String;
DatabaseStr:
String;
begin
Servername := '
mssql_server';
Databasename := '
databasename';
ADOConnection1.Connected := False;
ADOConnection1.LoginPrompt := false;
DatabaseStr :=
'
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Data Source='
+ Servername + '
;Initial Catalog=' + Databasename + '
;';
ADOConnection1.ConnectionString := DatabaseStr;
ADOConnection1.Connected := True;
ADOTable1.Active := true;
end;
end.