TdxReportDatabaseSQLConnection.ConnectionString Property
Specifies a connection string.
Declaration
property ConnectionString: string read; write;
Property Value
Type | Description |
---|---|
string | The connection string. |
Remarks
A connection string specifies the target database (SQL Server, PostgreSQL, SQLite, etc.) and all parameters required for connections.
Use the ConnectionString
property to specify a connection string according to syntax described in the following topic:
Code Example: Connect to an SQL Database and Edit Report Templates
The following code example uses the TdxReportDatabaseSQLConnection component to connect to a demo database (nwind.mdb), displays the Report Designer dialog, and saves all changes made to the UserReport.repx file:
uses
dxReport, // Declares the TdxReport component and related types
dxReport.ConnectionString.SQL; // Declares the TdxReportDatabaseSQLConnection component
// ...
procedure TMyForm.Button1Click(Sender: TObject);
var
ADataConnection: TdxReportDatabaseSQLConnection;
AReport: TdxReport;
begin
ADataConnection := TdxReportDatabaseSQLConnection.Create(Self);
try
ADataConnection.Name := 'DataConnection';
// Specify a connection string required to connect to a demo database (nwind.mdb)
ADataConnection.ConnectionString := 'XpoProvider=MSAccess;Provider=Microsoft.ACE.OLEDB.12.0;' +
'Data Source=C:\Users\Public\Documents\DevExpress VCL Demos\' +
'MegaDemos\Product Demos\ExpressPivotGrid\Data\nwind.mdb';
AReport := TdxReport.Create(Self);
try
AReport.ShowDesigner; // Displays the Web-based Report Designer dialog
AReport.Layout.SaveToFile('UserReport.repx'); // Saves the report template state to a file
finally
AReport.Free;
end;
finally
ADataConnection.Free;
end;
end;
Default Value
The ConnectionString
property’s default value is an empty string.
See Also