System.Data Namespace

The System.Data namespace provides classes that represent the .NET data access technologies. This includes classes for working with data sources such as SQL Server, OLE DB data sources, and XML. It provides support for disconnected data access through DataSet objects.

Classes

DataTable
public class DataTable : MarshalByRefObject, IList, ICollection, IEnumerable, ITypedList, ISupportInitialize
Represents a table of data in memory. A DataTable is one of the core objects that make up a DataSet.
Assembly: System.Data.dll

Properties

  • CaseSensitive: Gets or sets a value indicating whether string comparisons are case sensitive.
  • Constraints: Gets a collection of constraints for this DataTable.
  • Columns: Gets a collection of DataColumn objects that contains the columns for this table.
  • DefaultView: Gets a server-generated row that can be used to navigate the DataTable.
  • DataSet: Gets the DataSet that this table belongs to.
  • HasErrors: Gets a value indicating whether there are any errors in the data.
  • Locale: Gets or sets the current culture information for the table.
  • Namespace: Gets or sets the XML namespace for the DataTable.
  • ParentRelations: Gets a collection of DataRelation objects that represent parent-child relationships where this table is the child.
  • PrimaryKey: Gets or sets the array of DataColumn objects that uniquely identify rows in this table.
  • Properties: Gets a collection of properties that are supported by the DataTable.
  • Rows: Gets a collection of DataRow objects for this table.
  • SchemaSerializationMode: Gets or sets the schema serialization mode.
  • Site: Gets or sets the site for the component.
  • TableName: Gets or sets the name of the table.

Methods

  • AcceptChanges(): Commits all changes made since the last call to AcceptChanges().
  • BeginInit(): Begins the initialization of a DataTable.
  • Clear(): Removes all rows and columns from the DataTable.
  • Clone(): Creates and returns a shallow copy of the DataTable.
  • Compute(): Computes the result of an expression for a given row or set of rows.
  • Copy(): Creates and returns a deep copy of the DataTable.
  • EndInit(): Ends the initialization of a DataTable.
  • Equals(): Determines whether the specified object is equal to the current object.
  • GetErrors(): Gets all errors in the DataTable.
  • GetHashCode(): Serves as the default hash function.
  • GetType(): Gets the Type of the current instance.
  • ImportRow(): Imports a DataRow into the DataTable.
  • Load(): Loads data into the DataTable using IDataReader.
  • NewRow(): Creates a new DataRow with the same schema as the DataTable.
  • Parse(): Parses an XML string and loads data into the DataTable.
  • RejectChanges(): Rejects all changes made since the last call to AcceptChanges().
  • Reset(): Resets the DataTable to its initial state.
  • ToString(): Returns a string that represents the current object.
  • WriteXml(): Writes the current DataTable to an XML string.
  • WriteXmlSchema(): Writes the XML schema of the DataTable to an XML string.
DataRow
public class DataRow : MarshalByRefObject, ICloneable
Represents a row of data in a DataTable.
Assembly: System.Data.dll

Properties

  • AcceptRejectRule: Gets the rule for resolving conflicts when calling AcceptChanges() or RejectChanges() on a modified row.
  • RowError: Gets or sets the error description for the row.
  • RowState: Gets the current state of the row (Added, Modified, Deleted, Unchanged).
  • Table: Gets the DataTable that this row belongs to.

Methods

  • AcceptChanges(): Commits all changes made to this row since the last call to AcceptChanges().
  • BeginEdit(): Begins an edit operation for this row.
  • CancelEdit(): Cancels the current edit operation for this row.
  • Delete(): Marks the row for deletion.
  • EndEdit(): Ends the edit operation for this row.
  • Equals(): Determines whether the specified object is equal to the current object.
  • GetChildRows(): Gets the child rows for a specified relationship.
  • GetColumnError(): Gets the error description for the specified column.
  • GetHashCode(): Serves as the default hash function.
  • GetParentRow(): Gets the parent row for a specified relationship.
  • GetType(): Gets the Type of the current instance.
  • SetColumnError(): Sets the error description for the specified column.
  • ToString(): Returns a string that represents the current object.
DataColumn
public class DataColumn : MarshalByRefObject, ICloneable
Represents a column in a DataTable.
Assembly: System.Data.dll

Properties

  • AllowDBNull: Gets or sets a value indicating whether null values are allowed in this column.
  • AutoIncrement: Gets or sets a value indicating whether the values in this column will be automatically generated.
  • AutoIncrementSeed: Gets or sets the starting value for an auto-incrementing column.
  • AutoIncrementStep: Gets or sets the step increment for an auto-incrementing column.
  • Caption: Gets or sets the caption for the column.
  • ColumnName: Gets or sets the name of the column.
  • DataType: Gets or sets the data type of the values in this column.
  • DefaultValue: Gets or sets the default value for the column.
  • Expression: Gets or sets the expression used to filter or compute column values.
  • ExtendedProperties: Gets a collection of extended properties.
  • MaxLength: Gets or sets the maximum length of the column value.
  • Namespace: Gets or sets the XML namespace for the column.
  • Ordinal: Gets the zero-based index of the column.
  • ReadOnly: Gets or sets a value indicating whether the column can be updated.
  • Site: Gets or sets the site for the component.
  • Table: Gets the DataTable that this column belongs to.
  • Unique: Gets or sets a value indicating whether values in this column must be unique.

Methods

  • Equals(): Determines whether the specified object is equal to the current object.
  • GetHashCode(): Serves as the default hash function.
  • GetType(): Gets the Type of the current instance.
  • ToString(): Returns a string that represents the current object.
DataSet
public class DataSet : MarshalByRefObject, IList, ICollection, IEnumerable, ITypedList, ISupportInitialize
Represents an in-memory cache of data. A DataSet is an in-memory representation of relational data.
Assembly: System.Data.dll

Properties

  • CaseSensitive: Gets or sets a value indicating whether string comparisons are case sensitive.
  • DataSetName: Gets or sets the name of the DataSet.
  • EnforceConstraints: Gets or sets a value indicating whether constraints are enforced.
  • ExtendedProperties: Gets a collection of extended properties.
  • IsInitialized: Gets a value indicating whether the component is initialized.
  • Locale: Gets or sets the current culture information for the DataSet.
  • Namespace: Gets or sets the XML namespace for the DataSet.
  • Relations: Gets a collection of DataRelation objects.
  • SchemaSerializationMode: Gets or sets the schema serialization mode.
  • Site: Gets or sets the site for the component.
  • Tables: Gets a collection of DataTable objects.
  • XmlData: Gets the XML data of the DataSet.

Methods

  • AcceptChanges(): Commits all changes made since the last call to AcceptChanges().
  • BeginInit(): Begins the initialization of a DataSet.
  • Clear(): Removes all tables and data from the DataSet.
  • Clone(): Creates and returns a shallow copy of the DataSet.
  • Copy(): Creates and returns a deep copy of the DataSet.
  • EndInit(): Ends the initialization of a DataSet.
  • Equals(): Determines whether the specified object is equal to the current object.
  • GetErrors(): Gets all errors in the DataSet.
  • GetHashCode(): Serves as the default hash function.
  • GetType(): Gets the Type of the current instance.
  • InferXmlSchema(): Infers the XML schema from XML data.
  • Load(): Loads data and schema into the DataSet using IDataReader.
  • Merge(): Merges a specified DataSet into the current DataSet.
  • ReadXml(): Reads XML data into the DataSet.
  • ReadXmlSchema(): Reads the XML schema into the DataSet.
  • RejectChanges(): Rejects all changes made since the last call to AcceptChanges().
  • Reset(): Resets the DataSet to its initial state.
  • ToString(): Returns a string that represents the current object.
  • WriteXml(): Writes the current DataSet to an XML string.
  • WriteXmlSchema(): Writes the XML schema of the DataSet to an XML string.

Interfaces

IDataRecord
public interface IDataRecord
Provides methods for retrieving column values by ordinal or by name.
Assembly: System.Data.dll

Methods

  • FieldCount: Gets the number of columns in the current row.
  • GetBoolean(): Gets the value of the specified column as a boolean.
  • GetByte(): Gets the value of the specified column as a byte.
  • GetBytes(): Reads a stream of bytes from the specified column offset into the buffer as an array, starting at the given buffer offset.
  • GetChar(): Gets the value of the specified column as a character.
  • GetChars(): Reads a stream of characters from the specified column offset into the buffer as an array, starting at the given buffer offset.
  • GetDataTypeName(): Gets the data type name of the specified column.
  • GetDateTime(): Gets the value of the specified column as a DateTime object.
  • GetDecimal(): Gets the value of the specified column as a decimal number.
  • GetDouble(): Gets the value of the specified column as a double-precision floating-point number.
  • GetFieldType(): Gets the data type of the specified column.
  • GetGuid(): Gets the value of the specified column as a GUID.
  • GetInt16(): Gets the value of the specified column as a 16-bit integer.
  • GetInt32(): Gets the value of the specified column as a 32-bit integer.
  • GetInt64(): Gets the value of the specified column as a 64-bit integer.
  • GetName(): Gets the name of the specified column.
  • GetOrdinal(): Gets the zero-based column ordinal.
  • GetSqlBinary(): Gets the value of the specified column as SQL VARBINARY.
  • GetSqlBoolean(): Gets the value of the specified column as SQL BIT.
  • GetSqlByte(): Gets the value of the specified column as SQL TINYINT.
  • GetSqlBytes(): Gets the value of the specified column as SQL VARBINARY(MAX).
  • GetSqlDateTime(): Gets the value of the specified column as SQL DATETIME.
  • GetSqlDecimal(): Gets the value of the specified column as SQL DECIMAL or NUMERIC.
  • GetSqlDouble(): Gets the value of the specified column as SQL FLOAT or REAL.
  • GetSqlGuid(): Gets the value of the specified column as SQL UNIQUEIDENTIFIER.
  • GetSqlInt16(): Gets the value of the specified column as SQL SMALLINT.
  • GetSqlInt32(): Gets the value of the specified column as SQL INT.
  • GetSqlInt64(): Gets the value of the specified column as SQL BIGINT.
  • GetSqlMoney(): Gets the value of the specified column as SQL MONEY or SMALLMONEY.
  • GetSqlSingle(): Gets the value of the specified column as SQL REAL.
  • GetSqlString(): Gets the value of the specified column as SQL VARCHAR, NVARCHAR, TEXT, or NTEXT.
  • GetSqlXml(): Gets the value of the specified column as SQL XML.
  • GetStream(): Gets the value of the specified column as a stream.
  • GetString(): Gets the value of the specified column as a string.
  • GetTimeSpan(): Gets the value of the specified column as a TimeSpan.
  • GetValue(): Gets the value of the specified column.
  • GetXmlReader(): Gets the value of the specified column as an XmlReader.
  • IsDBNull(): Returns a value indicating whether the specified column contains a null value.