System.Web.UI.WebControls Namespace SqlDataSource Class
.NET Framework version 2.0
Sets or retrieves the ADO.NET provider–specific connection string that the SqlDataSource control uses to connect to an underlying database.
Inline |
<asp:SqlDataSource connectionstring = strConnectParameters ... > |
Script |
SqlDataSource.ConnectionString [ = strConnectParameters ] |
strConnectParameters |
A .NET Framework data provider–specific string that the SqlDataSource uses to connect to the SQL database that it represents. The default is an empty string ( "" ). |
The property is read/write with no default value.
The SqlDataSource control can be used with a variety of ADO.NET providers and the syntax of the connection string that is used to connect to an underlying data source is specific to the provider. For information about storing a connection string, see Securing Connection Strings When Using Data Source Controls. For information on valid connection strings, see the ConnectionString property topics for the SqlConnection, OracleConnection, OleDbConnection, and OdbcConnection classes.
If you change the ConnectionString property, the DataSourceChanged event is raised, causing any controls that are bound to the SqlDataSource control to rebind.
The following examples demonstrate how to set the ConnectionString property.
ProviderName