Back to Devexpress

SqlDataSource.ConnectionName Property

corelibraries-devexpress-dot-dataaccess-dot-sql-dot-sqldatasource-73299404.md

latest4.5 KB
Original Source

SqlDataSource.ConnectionName Property

Specifies the name of a data connection in the App.config file.

Namespace : DevExpress.DataAccess.Sql

Assembly : DevExpress.DataAccess.v25.2.dll

NuGet Package : DevExpress.DataAccess

Declaration

csharp
[LocalizableCategory(DataAccessStringId.PropertyGridConnectionCategoryName)]
public string ConnectionName { get; set; }
vb
<LocalizableCategory(DataAccessStringId.PropertyGridConnectionCategoryName)>
Public Property ConnectionName As String

Property Value

TypeDescription
String

A String value that specifies the data connection name in the App.config file.

|

Remarks

If you specify a data connection with the ConnectionName , the SqlDataSource.ConfigureDataConnection event does not fire.

To change connection parameters at runtime, create and register a service that implements the IConnectionProviderService interface.

The following code snippets (auto-collected from DevExpress Examples) contain references to the ConnectionName property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-dashboard-replace-sql-data-source-with-object-data-source-with-filtered-data/CS/WinFormsDashboard/ViewerForm.cs#L52

csharp
sqlDS.LoadFromXml(dsXML);
sqlDS.ConnectionName = "Connection";
sqlDS.Fill(query.Name);

web-forms-dashboard-replace-sql-data-source-with-object-data-source-with-filtered-data/CS/ASPxDashboard/Default.aspx.cs#L30

csharp
sqlDS.LoadFromXml(dsXML);
sqlDS.ConnectionName = dataSource.ConnectionName;
sqlDS.Fill(query.Name);

query-builder-use-in-asp-net-core-application/CS/AspNetCoreQueryBuilderApp/Data/DbInitializer.cs#L38

csharp
DisplayName = dataSourceItem.Key,
ConnectionName = dataSource.ConnectionName,
SerializedDataSource = SerializationService.SqlDataSourceToByteArray(dataSource),

winforms-dashboard-replace-sql-data-source-with-object-data-source-with-filtered-data/VB/WinFormsDashboard/ViewerForm.vb#L54

vb
sqlDS.LoadFromXml(dsXML)
sqlDS.ConnectionName = "Connection"
sqlDS.Fill(query.Name)

web-forms-dashboard-replace-sql-data-source-with-object-data-source-with-filtered-data/VB/ASPxDashboard/Default.aspx.vb#L26

vb
sqlDS.LoadFromXml(dsXML)
sqlDS.ConnectionName = dataSource.ConnectionName
sqlDS.Fill(query.Name)

See Also

SqlDataSource Class

SqlDataSource Members

DevExpress.DataAccess.Sql Namespace