Expand Minimize

System.Data Namespace

The System.Data namespace provides access to classes that represent the ADO.NET architecture. ADO.NET lets you 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 let you further guarantee data integrity. The Expression property lets you 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 DataRelationCollection of a DataSet object. 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 guarantees that values that are 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), the System.Data.OleDb namespace (the.NET Framework Data Provider for OLE DB), or the System.Data.OracleClient namespace (the .NET Framework Data Provider for Oracle), you can access a data source to use together with a DataSet. Each.NET Framework data provider has a corresponding DataAdapter that you use as a bridge between a data source and a DataSet.

  Class Description
Public class Constraint Represents a constraint that can be enforced on one or more DataColumn objects.
Public class ConstraintCollection Represents a collection of constraints for a DataTable.
Public class ConstraintException Represents the exception that is thrown when attempting an action that violates a constraint.
Public class DataColumn Represents the schema of a column in a DataTable.
Public class DataColumnChangeEventArgs Provides data for the ColumnChanging event.
Public class DataColumnCollection Represents a collection of DataColumn objects for a DataTable.
Public class DataException Represents the exception that is thrown when errors are generated using ADO.NET components.
Public class DataRelation Represents a parent/child relationship between two DataTable objects.
Public class DataRelationCollection Represents the collection of DataRelation objects for this DataSet.
Public class DataRow Represents a row of data in a DataTable.
Public class DataRowBuilder Infrastructure. The DataRowBuilder type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Public class DataRowChangeEventArgs Provides data for the RowChanged, RowChanging, OnRowDeleting, and OnRowDeleted events.
Public class DataRowCollection Represents a collection of rows for a DataTable.
Public class DataRowComparer Returns a singleton instance of the DataRowComparer<TRow> class.
Public class DataRowComparer<TRow> Compares two DataRow objects for equivalence by using value-based comparison.
Public class DataRowExtensions Defines the extension methods to the DataRow class. This is a static class.
Public class DataRowView Represents a customized view of a DataRow.
Public class DataSet Represents an in-memory cache of data.
Public class DataSetSchemaImporterExtension This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Public class DataSysDescriptionAttribute Obsolete. Marks a property, event, or extender with a description. Visual designers can display this description when referencing the member.
Public class DataTable Represents one table of in-memory data.
Public class DataTableClearEventArgs Provides data for the Clear method.
Public class DataTableCollection Represents the collection of tables for the DataSet.
Public class DataTableExtensions Defines the extension methods to the DataTable class. DataTableExtensions is a static class.
Public class DataTableNewRowEventArgs Provides data for the NewRow method.
Public class DataTableReader The DataTableReader obtains the contents of one or more DataTable objects in the form of one or more read-only, forward-only result sets.
Public class DataView Represents a databindable, customized view of a DataTable for sorting, filtering, searching, editing, and navigation. The DataView does not store data, but instead represents a connected view of its corresponding DataTable. Changes to the DataView’s data will affect the DataTable. Changes to the DataTable’s data will affect all DataViews associated with it.
Public class DataViewManager Contains a default DataViewSettingCollection for each DataTable in a DataSet.
Public class DataViewSetting Represents the default settings for ApplyDefaultSort, DataViewManager, RowFilter, RowStateFilter, Sort, and Table for DataViews created from the DataViewManager.
Public class DataViewSettingCollection Contains a read-only collection of DataViewSetting objects for each DataTable in a DataSet.
Public class DBConcurrencyException The exception that is thrown by the DataAdapter during an insert, update, or delete operation if the number of rows affected equals zero.
Public class DeletedRowInaccessibleException Represents the exception that is thrown when an action is tried on a DataRow that has been deleted.
Public class DuplicateNameException Represents the exception that is thrown when a duplicate database object name is encountered during an add operation in a DataSet -related object.
Public class EntityCommandCompilationException Represents errors that occur during command compilation; when a command tree could not be produced to represent the command text.
Public class EntityCommandExecutionException Represents errors that occur when the underlying storage provider could not execute the specified command. This exception usually wraps a provider-specific exception.
Public class EntityException Represents Entity Framework-related errors that occur in the EntityClient namespace. The EntityException is the base class for all Entity Framework exceptions thrown by the EntityClient.
Public class EntityKey Provides a durable reference to an object that is an instance of an entity type.
Public class EntityKeyMember Represents a key name and value pair that is part of an EntityKey.
Public class EntitySqlException Represents errors that occur when parsing Entity SQL command text. This exception is thrown when syntactic or semantic rules are violated.
Public class EnumerableRowCollection Represents a collection of DataRow objects returned from a LINQ to DataSet query. This API supports the .NET Framework infrastructure and is not intended to be used directly from your code. 
Public class EnumerableRowCollection<TRow> Represents a collection of DataRow objects returned from a query. This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Public class EnumerableRowCollectionExtensions Contains the extension methods for the data row collection classes. This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Public class EvaluateException Represents the exception that is thrown when the Expression property of a DataColumn cannot be evaluated.
Public class FillErrorEventArgs Provides data for the FillError event of a DbDataAdapter.
Public class 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.
Public class InRowChangingEventException Represents the exception that is thrown when you call the EndEdit method within the RowChanging event.
Public class InternalDataCollectionBase Provides the base functionality for creating collections.
Public class InvalidCommandTreeException The exception that is thrown to indicate that a command tree is invalid. This exception is currently not thrown anywhere in the Entity Framework.
Public class InvalidConstraintException Represents the exception that is thrown when incorrectly trying to create or access a relation.
Public class InvalidExpressionException Represents the exception that is thrown when you try to add a DataColumn that contains an invalid Expression to a DataColumnCollection.
Public class MappingException The exception that is thrown when mapping related service requests fail.
Public class MergeFailedEventArgs Occurs when a target and source DataRow have the same primary key value, and the EnforceConstraints property is set to true.
Public class MetadataException The exception that is thrown when metadata related service requests fails.
Public class MissingPrimaryKeyException Represents the exception that is thrown when you try to access a row in a table that has no primary key.
Public class NoNullAllowedException Represents the exception that is thrown when you try to insert a null value into a column where AllowDBNull is set to false.
Public class ObjectNotFoundException The exception that is thrown when an object is not present.
Public class OperationAbortedException This exception is thrown when an ongoing operation is aborted by the user.
Public class OptimisticConcurrencyException The exception that is thrown when an optimistic concurrency violation occurs.
Public class OrderedEnumerableRowCollection<TRow> This API supports the .NET Framework infrastructure and is not intended to be used directly from your code. Represents a collection of ordered DataRow objects returned from a query.
Public class PropertyCollection Represents a collection of properties that can be added to DataColumn, DataSet, or DataTable.
Public class PropertyConstraintException Property constraint exception class. Note that this class has state - so if you change even its internals, it can be a breaking change.
Public class ProviderIncompatibleException The exception that is thrown when the underlying data provider is incompatible with the Entity Framework.
Public class ReadOnlyException Represents the exception that is thrown when you try to change the value of a read-only column.
Public class RowNotInTableException Represents the exception that is thrown when you try to perform an operation on a DataRow that is not in a DataTable.
Public class StateChangeEventArgs Provides data for the state change event of a .NET Framework data provider.
Public class StatementCompletedEventArgs Provides additional information for the StatementCompleted event.
Public class StrongTypingException The exception that is thrown by a strongly typed DataSet when the user accesses a DBNull value.
Public class SyntaxErrorException Represents the exception that is thrown when the Expression property of a DataColumn contains a syntax error.
Public class TypedDataSetGenerator Obsolete. Used to create a strongly typed DataSet.
Public class TypedDataSetGeneratorException The exception that is thrown when a name conflict occurs while generating a strongly typed DataSet.
Public class TypedTableBase<T> This type is used as a base class for typed-DataTable object generation by Visual Studio and the XSD.exe .NET Framework tool, and is not intended to be used directly from your code.
Public class TypedTableBaseExtensions Contains the extension methods for the TypedTableBase<T> class.
Public class UniqueConstraint Represents a restriction on a set of columns in which all values must be unique.
Public class UpdateException The exception that is thrown when modifications to object instances cannot be persisted to the data source.
Public class VersionNotFoundException Represents the exception that is thrown when you try to return a version of a DataRow that has been deleted.

  Interface Description
Public interface 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.
Public interface IColumnMappingCollection Contains a collection of DataColumnMapping objects, and is implemented by the DataColumnMappingCollection, which is used in common by .NET Framework data providers.
Public interface IDataAdapter Allows an object to implement a DataAdapter, and represents a set of methods and mapping action-related properties that are used to fill and update a DataSet and update a data source.IDbDataAdapter instances are for data sources that are (or resemble) relational databases with textual commands (like Transact-SQL), while IDataAdapter instances could can use any type of data source.
Public interface 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.
Public interface 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.
Public interface 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.
Public interface 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.
Public interface 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.
Public interface IDbConnection Represents an open connection to a data source, and is implemented by .NET Framework data providers that access relational databases.
Public interface 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.
Public interface IDbDataParameter Used by the Visual Basic .NET Data Designers to represent a parameter to a Command object, and optionally, its mapping to DataSet columns.
Public interface IDbTransaction Represents a transaction to be performed at a data source, and is implemented by .NET Framework data providers that access relational databases.
Public interface IExtendedDataRecord Provides access to the column values within each row of a DbDataRecord for a DbDataReader.
Public interface 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.
Public interface ITableMappingCollection Contains a collection of TableMapping objects, and is implemented by the DataTableMappingCollection, which is used in common by .NET Framework data providers.

  Delegate Description
Public delegate DataColumnChangeEventHandler Represents the method that will handle the ColumnChanging event.
Public delegate DataRowChangeEventHandler Represents the method that will handle the RowChanging, RowChanged, RowDeleting, and RowDeleted events of a DataTable.
Public delegate DataTableClearEventHandler Represents the method that handles the Clear method.
Public delegate DataTableNewRowEventHandler Represents the method that handles the NewRow method.
Public delegate FillErrorEventHandler Represents the method that will handle the FillError event.
Public delegate MergeFailedEventHandler Represents the method that will handle the MergeFailed event.
Public delegate StateChangeEventHandler Represents the method that will handle the StateChange event.
Public delegate StatementCompletedEventHandler The delegate type for the event handlers of the StatementCompleted event.

  Enumeration Description
Public enumeration AcceptRejectRule Determines the action that occurs when the AcceptChanges or RejectChanges method is invoked on a DataTable with a ForeignKeyConstraint.
Public enumeration CommandBehavior Provides a description of the results of the query and its effect on the database.
Public enumeration CommandType Specifies how a command string is interpreted.
Public enumeration ConflictOption Specifies how conflicting changes to the data source will be detected and resolved.
Public enumeration ConnectionState Describes the current state of the connection to a data source.
Public enumeration DataRowAction Describes an action performed on a DataRow.
Public enumeration DataRowState Gets the state of a DataRow object.
Public enumeration DataRowVersion Describes the version of a DataRow.
Public enumeration DataSetDateTime Describes the serialization format for DateTime columns in a DataSet.
Public enumeration DataViewRowState Describes the version of data in a DataRow.
Public enumeration DbType Specifies the data type of a field, a property, or a Parameter object of a .NET Framework data provider.
Public enumeration EntityState The state of an entity object.
Public enumeration IsolationLevel Specifies the transaction locking behavior for the connection.
Public enumeration KeyRestrictionBehavior Identifies a list of connection string parameters identified by the KeyRestrictions property that are either allowed or not allowed.
Public enumeration LoadOption Controls how the values from the data source will be applied to existing rows when using the Load or Load method.
Public enumeration MappingType Specifies how a DataColumn is mapped.
Public enumeration MissingMappingAction Determines the action that occurs when a mapping is missing from a source table or a source column.
Public enumeration MissingSchemaAction Specifies the action to take when adding data to the DataSet and the required DataTable or DataColumn is missing.
Public enumeration ParameterDirection Specifies the type of a parameter within a query relative to the DataSet.
Public enumeration PropertyAttributes Obsolete. Specifies the attributes of a property.
Public enumeration Rule Indicates the action that occurs when a ForeignKeyConstraint is enforced.
Public enumeration SchemaSerializationMode Indicates the schema serialization mode for a typed DataSet.
Public enumeration SchemaType Specifies how to handle existing schema mappings when performing a FillSchema operation.
Public enumeration SerializationFormat Determines the serialization format for a DataSet.
Public enumeration SqlDbType Specifies SQL Server-specific data type of a field, property, for use in a SqlParameter.
Public enumeration StatementType Specifies the type of SQL query to be used by the OleDbRowUpdatedEventArgs, OleDbRowUpdatingEventArgs, SqlRowUpdatedEventArgs, or SqlRowUpdatingEventArgs class.
Public enumeration UpdateRowSource Specifies how query command results are applied to the row being updated.
Public enumeration UpdateStatus Specifies the action to take with regard to the current and remaining rows during an Update.
Public enumeration XmlReadMode Specifies how to read XML data and a relational schema into a DataSet.
Public enumeration XmlWriteMode Specifies how to write XML data and a relational schema from a DataSet.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft