SqlDataSource::ProviderName Property

 

Gets or sets the name of the .NET Framework data provider that the SqlDataSource control uses to connect to an underlying data source.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public:
[TypeConverterAttribute("System.Web.UI.Design.WebControls.DataProviderNameConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
property String^ ProviderName {
	virtual String^ get();
	virtual void set(String^ value);
}

Property Value

Type: System::String^

The name of the data provider that the SqlDataSource uses; otherwise, the ADO.NET provider for Microsoft SQL Server, if no provider is set. The default is the ADO.NET provider for Microsoft SQL Server.

The .NET Framework includes the following data providers:

The ProviderName property is never set to the name of an unmanaged ADO.NET provider, such as MSDAORA. For more information, see Selecting Data Using the SqlDataSource Control.

If you change the ProviderName property, the DataSourceChanged event is raised, causing any controls that are bound to the SqlDataSource to rebind.

A list of available providers is specified in the DbProviderFactories subsection of the system.data section of the Machine.config file.

This section contains two code examples. The first code demonstrates how to connect to a SQL Server database using the default .NET Framework Data Provider for SQL Server for the SqlDataSource control, the System.Data.SqlClient. The second code example demonstrates how to connect to an ODBC database using the .NET Framework Data Provider for ODBC, the System.Data.Odbc.

The following code example demonstrates how to connect to a SQL Server database using the default data provider for the SqlDataSource control, the System.Data.SqlClient. Whenever the ProviderName property is not explicitly set, the default provider is used. The ConnectionString property is provider-specific.

No code example is currently available or this language may not be supported.

The following code example, which is functionally the same as the preceding code example, demonstrates how to connect to an ODBC database using the .NET Framework Data Provider for ODBC, the System.Data.Odbc. The ConnectionString property is set to the name of an ODBC data source name (DSN) that is used to connect to the ODBC database.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: