SqlDataSourceMode Enumeration
Specifies whether a SqlDataSource or AccessDataSource control retrieves data as a IDataReader or DataSet.
Assembly: System.Web (in System.Web.dll)
| Member name | Description | |
|---|---|---|
| DataReader | Retrieves data from the underlying data storage as an IDataReader | |
| DataSet | Retrieves data from the underlying data storage into a DataSet structure. |
The SqlDataSourceMode enumeration is used by the SqlDataSource and AccessDataSource controls to describe the data retrieval mode that the data source control uses when the Select method is called. When the DataSourceMode property is set to DataSet, data is loaded into a DataSet structure. This enables scenarios where user interface controls such as GridView offer sorting and paging capabilities. When the DataSourceMode property is set to DataReader, data is retrieved by an IDataReader object, which is a read-only, forward-only cursor.
The SqlDataSourceMode enumeration is only used to describe how the Select command retrieves data; it has no effect on other operations the SqlDataSource control performs, such as Insert, Update, or Delete.
| Topic | Location |
|---|---|
| How to: Connect to an ODBC Database Using the SqlDataSource Control | Building ASP .NET Web Applications |
| How to: Access SQL Server as a Local User | Building ASP .NET Web Applications |
| How to: Connect to an ODBC Database Using the SqlDataSource Control | Building ASP .NET Web Applications |
| How to: Access SQL Server as a Local User | Building ASP .NET Web Applications |
| How to: Connect to an ODBC Database Using the SqlDataSource Control (Visual Studio) | Building ASP .NET Web Applications in Visual Studio |
The following code example demonstrates how to set the DataSourceMode of a SqlDataSource control to DataReader when retrieving a simple list of items from a SQL Server database into a ListBox control.
The following code example demonstrates how to set the DataSourceMode to DataSet when retrieving a set of data into a GridView control that has sorting enabled.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.