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 thisDataTable
.Columns
: Gets a collection ofDataColumn
objects that contains the columns for this table.DefaultView
: Gets a server-generated row that can be used to navigate theDataTable
.DataSet
: Gets theDataSet
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 theDataTable
.ParentRelations
: Gets a collection ofDataRelation
objects that represent parent-child relationships where this table is the child.PrimaryKey
: Gets or sets the array ofDataColumn
objects that uniquely identify rows in this table.Properties
: Gets a collection of properties that are supported by theDataTable
.Rows
: Gets a collection ofDataRow
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 toAcceptChanges()
.BeginInit()
: Begins the initialization of aDataTable
.Clear()
: Removes all rows and columns from theDataTable
.Clone()
: Creates and returns a shallow copy of theDataTable
.Compute()
: Computes the result of an expression for a given row or set of rows.Copy()
: Creates and returns a deep copy of theDataTable
.EndInit()
: Ends the initialization of aDataTable
.Equals()
: Determines whether the specified object is equal to the current object.GetErrors()
: Gets all errors in theDataTable
.GetHashCode()
: Serves as the default hash function.GetType()
: Gets the Type of the current instance.ImportRow()
: Imports aDataRow
into theDataTable
.Load()
: Loads data into theDataTable
usingIDataReader
.NewRow()
: Creates a newDataRow
with the same schema as theDataTable
.Parse()
: Parses an XML string and loads data into theDataTable
.RejectChanges()
: Rejects all changes made since the last call toAcceptChanges()
.Reset()
: Resets theDataTable
to its initial state.ToString()
: Returns a string that represents the current object.WriteXml()
: Writes the currentDataTable
to an XML string.WriteXmlSchema()
: Writes the XML schema of theDataTable
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 callingAcceptChanges()
orRejectChanges()
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 theDataTable
that this row belongs to.
Methods
AcceptChanges()
: Commits all changes made to this row since the last call toAcceptChanges()
.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 theDataTable
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 theDataSet
.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 theDataSet
.Namespace
: Gets or sets the XML namespace for theDataSet
.Relations
: Gets a collection ofDataRelation
objects.SchemaSerializationMode
: Gets or sets the schema serialization mode.Site
: Gets or sets the site for the component.Tables
: Gets a collection ofDataTable
objects.XmlData
: Gets the XML data of theDataSet
.
Methods
AcceptChanges()
: Commits all changes made since the last call toAcceptChanges()
.BeginInit()
: Begins the initialization of aDataSet
.Clear()
: Removes all tables and data from theDataSet
.Clone()
: Creates and returns a shallow copy of theDataSet
.Copy()
: Creates and returns a deep copy of theDataSet
.EndInit()
: Ends the initialization of aDataSet
.Equals()
: Determines whether the specified object is equal to the current object.GetErrors()
: Gets all errors in theDataSet
.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 theDataSet
usingIDataReader
.Merge()
: Merges a specifiedDataSet
into the currentDataSet
.ReadXml()
: Reads XML data into theDataSet
.ReadXmlSchema()
: Reads the XML schema into theDataSet
.RejectChanges()
: Rejects all changes made since the last call toAcceptChanges()
.Reset()
: Resets theDataSet
to its initial state.ToString()
: Returns a string that represents the current object.WriteXml()
: Writes the currentDataSet
to an XML string.WriteXmlSchema()
: Writes the XML schema of theDataSet
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 SQLVARBINARY
.GetSqlBoolean()
: Gets the value of the specified column as SQLBIT
.GetSqlByte()
: Gets the value of the specified column as SQLTINYINT
.GetSqlBytes()
: Gets the value of the specified column as SQLVARBINARY(MAX)
.GetSqlDateTime()
: Gets the value of the specified column as SQLDATETIME
.GetSqlDecimal()
: Gets the value of the specified column as SQLDECIMAL
orNUMERIC
.GetSqlDouble()
: Gets the value of the specified column as SQLFLOAT
orREAL
.GetSqlGuid()
: Gets the value of the specified column as SQLUNIQUEIDENTIFIER
.GetSqlInt16()
: Gets the value of the specified column as SQLSMALLINT
.GetSqlInt32()
: Gets the value of the specified column as SQLINT
.GetSqlInt64()
: Gets the value of the specified column as SQLBIGINT
.GetSqlMoney()
: Gets the value of the specified column as SQLMONEY
orSMALLMONEY
.GetSqlSingle()
: Gets the value of the specified column as SQLREAL
.GetSqlString()
: Gets the value of the specified column as SQLVARCHAR
,NVARCHAR
,TEXT
, orNTEXT
.GetSqlXml()
: Gets the value of the specified column as SQLXML
.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 aTimeSpan
.GetValue()
: Gets the value of the specified column.GetXmlReader()
: Gets the value of the specified column as anXmlReader
.IsDBNull()
: Returns a value indicating whether the specified column contains a null value.