System.Data Namespace
The System.Data namespace consists mostly of the classes that constitute the ADO.NET architecture. The ADO.NET architecture enables you to build components that efficiently manage data from multiple data sources. In a disconnected scenario (such as the Internet), ADO.NET provides the tools to request, update, and reconcile data in multiple tier systems. The ADO.NET architecture is also implemented in client applications, such as Windows Forms, or HTML pages created by ASP.NET.
The centerpiece of the ADO.NET architecture is the DataSet class. Each DataSet can contain multiple DataTable objects, with each DataTable containing data from a single data source, such as SQL Server.
Each DataTable contains a DataColumnCollection--a collection of DataColumn objects--that determines the schema of each DataTable. The DataType property determines the type of data held by the DataColumn. The ReadOnly and AllowDBNull properties allow you to further ensure data integrity. The Expression property enables you to construct calculated columns.
If a DataTable participates in a parent/child relationship with another DataTable, the relationship is constructed by adding a DataRelation to the DataSet object's DataRelationCollection. When such a relation is added, a UniqueConstraint and a ForeignKeyConstraint are both created automatically (depending on the parameter settings for the constructor). The UniqueConstraint ensures that values contained in a column are unique. The ForeignKeyConstraint determines what action will happen to the child row or column when a primary key value is changed or deleted.
Using the System.Data.SqlClient namespace (the .NET Framework Data Provider for SQL Server), the System.Data.Odbc namespace (the .NET Framework Data Provider for ODBC), or the System.Data.OleDb namespace (the .NET Framework Data Provider for OLE DB), you can access a data source to use in conjunction with a DataSet. Each .NET data provider has a corresponding DataAdapter that you use as a bridge between a data source and a DataSet.
Classes
| Class | Description |
|---|---|
| Constraint | Represents a constraint that can be enforced on one or more DataColumn objects. |
| ConstraintCollection | Represents a collection of constraints for a DataTable. |
| ConstraintException | Represents the exception that is thrown when attempting an action that violates a constraint. |
| DataColumn | Represents the schema of a column in a DataTable. |
| DataColumnChangeEventArgs | Provides data for the ColumnChanging event. |
| DataColumnCollection | Represents a collection of DataColumn objects for a DataTable. |
| DataException | Represents the exception that is thrown when errors are generated using ADO.NET components. |
| DataRelation | Represents a parent/child relationship between two DataTable objects. |
| DataRelationCollection | Represents the collection of DataRelation objects for this DataSet. |
| DataRow | Represents a row of data in a DataTable. |
| DataRowChangeEventArgs | Provides data for the RowChanged, RowChanging, OnRowDeleting, and OnRowDeleted events. |
| DataRowCollection | Represents a collection of rows for a DataTable. |
| DataRowView | Represents a customized view of a DataRow exposed as a fully featured Windows Forms control. |
| DataSet | Represents an in-memory cache of data. |
| DataSysDescriptionAttribute | Marks a property, event, or extender with a description. Visual designers can display this description when referencing the member. |
| DataTable | Represents one table of in-memory data. |
| DataTableCollection | Represents the collection of tables for the DataSet. |
| DataView | Represents a databindable, customized view of a DataTable for sorting, filtering, searching, editing, and navigation. |
| DataViewManager | Contains a default DataViewSettingCollection for each DataTable in a DataSet. |
| DataViewSetting | Represents the default settings for ApplyDefaultSort, DataViewManager, RowFilter, RowStateFilter, Sort, and Table for DataViews created from the DataViewManager. |
| DataViewSettingCollection | Contains a read-only collection of DataViewSetting objects for each DataTable in a DataSet. |
| DBConcurrencyException | The exception that is thrown by the DataAdapter during the update operation if the number of rows affected equals zero. |
| DeletedRowInaccessibleException | Represents the exception that is thrown when an action is attempted on a DataRow that has been deleted. |
| DuplicateNameException | Represents the exception that is thrown when a duplicate database object name is encountered during an add operation in a DataSet-related object. |
| EvaluateException | Represents the exception that is thrown when the Expression property of a DataColumn cannot be evaluated. |
| FillErrorEventArgs | Provides data for the FillError event of a DbDataAdapter. |
| ForeignKeyConstraint | Represents an action restriction enforced on a set of columns in a primary key/foreign key relationship when a value or row is either deleted or updated. |
| InRowChangingEventException | Represents the exception that is thrown when calling the EndEdit method within the RowChanging event. |
| InternalDataCollectionBase | Provides the base functionality for creating collections. |
| InvalidConstraintException | Represents the exception that is thrown when incorrectly attempting to create or access a relation. |
| InvalidExpressionException | Represents the exception that is thrown when attempting to add a DataColumn containing an invalid Expression to a DataColumnCollection. |
| MergeFailedEventArgs | Occurs when a target and source DataRow have the same primary key value, and the EnforceConstraints property is set to true. |
| MissingPrimaryKeyException | Represents the exception that is thrown when attempting to access a row in a table that has no primary key. |
| NoNullAllowedException | Represents the exception that is thrown when attempting to insert a null value into a column where AllowDBNull is set to false. |
| PropertyCollection | Represents a collection of properties that can be added to DataColumn, DataSet, or DataTable. |
| ReadOnlyException | Represents the exception that is thrown when attempting to change the value of a read-only column. |
| RowNotInTableException | Represents the exception that is thrown when trying to perform an operation on a DataRow that is not in a DataTable. |
| StateChangeEventArgs | Provides data for the state change event of a .NET Framework data provider. |
| StrongTypingException | The exception that is thrown by a strongly-typed DataSet when the user accesses DBNull value. |
| SyntaxErrorException | Represents the exception that is thrown when the Expression property of a DataColumn contains a syntax error. |
| TypedDataSetGenerator | Used to create a strongly-typed DataSet. |
| TypedDataSetGeneratorException | The exception that is thrown when a name conflict occurs while generating a strongly-typed DataSet. |
| UniqueConstraint | Represents a restriction on a set of columns in which all values must be unique. |
| VersionNotFoundException | Represents the exception that is thrown when attempting to return a version of a DataRow that has been deleted. |
Interfaces
| Interface | Description |
|---|---|
| IColumnMapping | Associates a data source column with a DataSet column, and is implemented by the DataColumnMapping class, which is used in common by .NET Framework data providers. |
| IColumnMappingCollection | Contains a collection of DataColumnMapping objects, and is implemented by the DataColumnMappingCollection, which is used in common by .NET Framework data providers. |
| IDataAdapter | Allows an object to implement a DataAdapter, and represents a set of methods and mapping action-related properties used to fill and refresh a DataSet and update a data source. |
| IDataParameter | Represents a parameter to a Command object, and optionally, its mapping to DataSet columns; and is implemented by .NET Framework data providers that access data sources. |
| IDataParameterCollection | Collects all parameters relevant to a Command object and their mappings to DataSet columns, and is implemented by .NET Framework data providers that access data sources. |
| IDataReader | Provides a means of reading one or more forward-only streams of result sets obtained by executing a command at a data source, and is implemented by .NET Framework data providers that access relational databases. |
| IDataRecord | Provides access to the column values within each row for a DataReader, and is implemented by .NET Framework data providers that access relational databases. |
| IDbCommand | Represents an SQL statement that is executed while connected to a data source, and is implemented by .NET Framework data providers that access relational databases. |
| IDbConnection | Represents an open connection to a data source, and is implemented by .NET Framework data providers that access relational databases. |
| IDbDataAdapter | Represents a set of command-related properties that are used to fill the DataSet and update a data source, and is implemented by .NET Framework data providers that access relational databases. |
| IDbDataParameter | Used by the Visual Basic .NET Data Designers to represent a parameter to a Command object, and optionally, its mapping to DataSet columns. |
| IDbTransaction | Represents a transaction to be performed at a data source, and is implemented by .NET Framework data providers that access relational databases. |
| ITableMapping | Associates a source table with a table in a DataSet, and is implemented by the DataTableMapping class, which is used in common by .NET Framework data providers. |
| ITableMappingCollection | Contains a collection of TableMapping objects, and is implemented by the DataTableMappingCollection, which is used in common by .NET Framework data providers. |
Delegates
| Delegate | Description |
|---|---|
| DataColumnChangeEventHandler | Represents the method that will handle the ColumnChanging event. |
| DataRowChangeEventHandler | Represents the method that will handle the RowChanging, RowChanged, RowDeleting, and RowDeleted events of a DataTable. |
| FillErrorEventHandler | Represents the method that will handle the FillError event. |
| MergeFailedEventHandler | Represents the method that will handle the MergeFailed event. |
| StateChangeEventHandler | Represents the method that will handle the StateChange event. |
Enumerations
| Enumeration | Description |
|---|---|
| AcceptRejectRule | Determines the action that occurs when the AcceptChanges or RejectChanges method is invoked on a DataTable with a ForeignKeyConstraint. |
| CommandBehavior | Provides a description of the results of the query and its effect on the database. |
| CommandType | Specifies how a command string is interpreted. |
| ConnectionState | Describes the current state of the connection to a data source. |
| DataRowAction | Describes an action performed on a DataRow. |
| DataRowState | Gets the state of a DataRow object. |
| DataRowVersion | Describes the version of a DataRow. |
| DataViewRowState | Describes the version of data in a DataRow. |
| DbType | Specifies the data type of a field, a property, or a Parameter object of a .NET Framework data provider. |
| IsolationLevel | Specifies the transaction locking behavior for the connection. |
| KeyRestrictionBehavior | Identifies a list of connection string parameters identified by the KeyRestrictions property that are either allowed or not allowed. |
| MappingType | Specifies how a DataColumn is mapped. |
| MissingMappingAction | Determines the action that occurs when a mapping is missing from a source table or a source column. |
| MissingSchemaAction | Specifies the action to take when adding data to the DataSet and the required DataTable or DataColumn is missing. |
| ParameterDirection | Specifies the type of a parameter within a query relative to the DataSet. |
| PropertyAttributes | Specifies the attributes of a property. |
| Rule | Indicates the action that occurs when a ForeignKeyConstraint is enforced. |
| SchemaType | Specifies how to handle existing schema mappings when performing a FillSchema operation. |
| SqlDbType | Specifies SQL Server-specific data type of a field, property, for use in a SqlParameter. |
| StatementType | Specifies the type of SQL query to be used by the OleDbRowUpdatedEventArgs, OleDbRowUpdatingEventArgs, SqlRowUpdatedEventArgs, or SqlRowUpdatingEventArgs class. |
| UpdateRowSource | Specifies how query command results are applied to the row being updated. |
| UpdateStatus | Specifies the action to take with regard to the current and remaining rows during an Update. |
| XmlReadMode | Specifies how to read XML data and a relational schema into a DataSet. |
| XmlWriteMode | Specifies how to write XML data and a relational schema from a DataSet. |