System.Data Namespace

I l @ ve RuBoard

System.Data Namespace

The System.Data namespace consists mainly of classes that make up ADO.NET. ADO.NET allows a developer to build components that manage data from data sources.

DataColumn Object Members

The DataColumn class represents the schema of a column in a DataTable object. Tables B.1 through B.4 list the constructor, properties, and methods for the DataColumn class.

Table B.1. DataColumn Constructor
Name Parameters Description
DataColumn none Initializes a new instance of the DataColumn class.
DataColumn columnName (String) Initializes a new instance of the DataColumn class with the specified name.
DataColumn

columnName (String)

dataType (Type)

Initializes a new instance of the DataColumn class with the specified name and data type.
DataColumn

columnName (String)

dataType (Type)

expr (String)

Initializes a new instance of the DataColumn class with the specified name, data type, and expression.
DataColumn

columnName (String)

dataType (Type)

expr (String)

type (MappingType)

Initializes a new instance of the DataColumn class with the specified name, data type, expression, and value that determines whether the column is an attribute.
Table B.2. DataColumn Properties
Name Type Description
AllowDBNull Boolean Retrieves or sets a value indicating whether null values are allowed in this column for rows in this table.
AutoIncrement Boolean Retrieves or sets a value indicating whether the column automatically increments the value of the column for new rows added to the table.
AutoIncrementSeed Long Retrieves or sets the starting value for a column that has its AutoIncrement property set to true.
AutoIncrementStep Long Retrieves or sets the increment used by a column with its AutoIncrement property set to true.
Caption String Retrieves or sets the caption for this column.
ColumnMapping MappingType Retrieves or sets the MappingType of the column.
ColumnName String Retrieves or sets the name of the column within the collection.
Container IContainer Retrieves the container for the component.
DataType Type The type of data stored in the column.
DefaultValue Object Retrieves or sets the default value for the column when creating new rows.
DesignMode Boolean Retrieves a value indicating of the component is in design mode.
Expression String Retrieves or sets the expression used to either filter rows, calculate the column's value, or create an aggregate column.
ExtendedProperties Property Collection Retrieves the collection of custom user information.
Namespace String Gets or sets the namespace of the DataColumn .
Ordinal Integer Retrieves the position of the column in the collection.
Prefix String Gets or sets the XML prefix that aliases the DataTable's namespace.
ReadOnly Boolean Retrieves or sets a value indicating whether the column allows changes after a row has been added to the table.
Site ISite Retrieves or sets the site of the component.
Table DataTable Retrieves the DataTable the column belongs to.
Unique Boolean Retrieves or sets a value indicating whether the values in each row must be unique.
Table B.3. DataColumn Methods
Name Parameters Description
Dispose none Disposes the component.
Dispose disposing (Boolean) Releases the unmanaged resources used by the MarshalByValue Component and optionally releases the managed resources.
Equals obj (Object) Determines whether the specified object is the same instance as the current object.
Equals

objA (Object)

objB (Object)

Determines if the specified object instances are equal.
GetHashCode none Serves as a hash function for a particular type.
GetService service (Type) Gets the implementer of the IServiceProvider.
GetType none Retrieves the type of the object.
ToString none Returns a string that represents the current object.
Table B.4. DataColumn Event
Name Description
Disposed Adds an event handler to listen to the Disposed event of the component.

DataRow Object Members

The DataRow class represents a row of data in a DataTable . Tables B.5 and B.6 list the properties and methods for the DataRow class.

Table B.5. DataRow Properties
Name Type Description
HasErrors Boolean Retrieves a value indicating whether there are errors in the collection.
Item Object Retrieves or sets data stored in the column.
ItemArray Object Retrieves or sets all the values for this row through an array.
RowError String Retrieves or sets the custom error description for a row.
RowState DataRowState Retrieves the current state of the row in regard to its relationship to the RowsCollection .
Table DataTable Retrieves the DataTable for which this row has a schema.
Table B.6. DataRow Methods
Name Parameters Description
AcceptChanges none Commits all changes made to this row since the last time this method was called.
BeginEdit none Begins an edit operation on a DataRow object.
CancelEdit none Cancels the current edit on the row.
ClearErrors none Clears the errors for the row, including the RowError and errors set with SetColumnError.
Delete none Deletes the row.
EndEdit none End the edit occurring for this row.
Equals obj (Object) Determines whether the specified object is the same instance as the current object.
Equals

objA (Object)

objB (Object)

Determines if the specified object instances are equal.
GetChildRows relation (DataRelation) Retrieves the child rows of this DataRow using the specified DataRelation .
GetChildRows relationName (String) Retrieves the child rows of this DataRow using the named DataRelation .
GetChildRows

relation (DataRelation)

version DataRowVersion

Retrieves the child rows of this DataRow using the specified DataRelation and (DataRowVersion) .
GetChildRows

relationName (String)

version (DataRowVersion)

Retrieves the specified version of the child rows using the specified DataRelation .
GetColumnError columnIndex (Integer) Retrieves the error description for the column using the specified index.
GetColumnError columnName (String) Retrieves the error description for the column using the specified name.
GetColumnError column (DataColumn) Retrieves the error description for the column using the specified DataColumn .
GetColumnsInError none Retrieves an array of columns that have errors.
GetHashCode none Serves as a hash function for a particular type.
GetParentRow relationName (String) Retrieves the parent row of a DataRow using the specified relation name.
GetParentRow relation (DataRelation) Retrieves the parent row of a DataRow using the specified DataRelation .
GetParentRow

relationName (String)

version (DataRowVersion)

Retrieves the parent row of a DataRow using the specified relation name and the specified DataRowVersion .
GetParentRow

relation (DataRelation)

version (DataRowVersion)

Retrieves the parent row of a DataRow using the specified DataRelation and the specified DataRowVersion .
GetParentRows relation (DataRelation) Retrieves the parent rows of a DataRow , using the specified DataRelation .
GetParentRows relationName (String) Retrieves the parent rows of a DataRow , using the specified relation name.
GetParentRows

relationName (String)

version (DataRowVersion)

Retrieves the parent rows of a DataRow , using the specified relation name and the specified DataRowVersion .
GetParentRows

relation (DataRelation)

version (DataRowVersion)

Retrieves the parent rows of a DataRow , using the specified DataRelation and the specified DataRowVersion .
GetType none Retrieves the type of the object.
HasVersion version (DataRowVersion) Retrieves a value indicating whether a specified version exists.
IsNull column (DataColumn) Retrieves a value indicating whether the specified DataColumn contains a null value.
IsNull columnName (String) Retrieves a value indicating whether the specified named column contains a null value.
IsNull columnIndex (Integer) Retrieves a value indicating whether the column with the specified index contains a null value.
IsNull

column (DataColumn)

Version (DataRowVersion)

Gets a value indicating whether the specified DataColumn and DataRowVersion contains a null value.
RejectChanges none Rejects all changes made to the row since the AcceptChanges method was last called.
SetColumnError

columnName (String)

error (String)

Sets the error description for a specified named column.
SetColumnError

column (DataColumn)

error (String)

Sets the error description for a specified DataColumn .
SetColumnError

columnIndex (Integer)

error (String)

Sets the error description for a column with a specified index.
SetParentRow parentRow (DataRow) Sets the parent row of a DataRow with the specified DataRow.
SetParentRow

parentRow (DataRow)

relation (DataRelation)

Sets the parent row of a specified DataRow with the specified DataRow and DataRelation .
SetUnspecified column (DataColumn) Sets the value of a DataColumn with the specified name to unspecified.
ToString none Returns a string that represents the current object.

DataSet Object Members

The DataSet class represents an in-memory cache of data. Tables B.7 through B.10 list the constructor, properties, methods, and events for the DataSet class.

Table B.7. DataSet Constructor
Name Parameters Description
DataSet none Initializes a new instance of the DataSet class.
DataSet

info (SerializationInfo)

context (StreamingContext)

Initializes a new DataSet class with the SerializationInfo and StreamingContext .
DataSet name (String) Initializes a new instance of the DataSet class with the specified name.
Table B.8. DataSet Properties
Name Type Description
CaseSensitive Boolean Retrieves or sets a value indicating whether string comparisons within DataTable objects are case sensitive.
Container IContainer Retrieves the container for the component.
DataSetName String Retrieves or sets the name of the DataSet .
DefaultViewManager DataViewManager Retrieves a custom view of the data contained by the DataSet .
DesignMode Boolean Retrieves a value indicating the component is in design mode.
EnforceConstraints Boolean Retrieves or sets a value indicating whether constraint rules are followed when an update operation is performed.
ExtendedProperties PropertyCollection Retrieves the collection of custom user information.
HasErrors Boolean Retrieves a value indicating whether there are errors in any of the rows in any of the tables of this DataSet .
Locale CultureInfo Retrieves or sets the locale information used to compare strings within the table.
NameSpace String Retrieves or sets the namespace of the DataSet .
Prefix String Retrieves or sets an XML prefix that aliases the namespace of the DataSet .
Relations Data RelationCollection Retrieves the collection of relations that link tables and allow navigation from parent tables to child tables.
Site ISite Retrieves or sets the site of the component.
Tables Data TableCollection Retrieves the collection of tables contained in the DataSet .
Table B.9. DataSet Methods
Name Parameters Description
AcceptChanges none Commits all changes made to this DataSet since it was loaded or the last time the AcceptChanges method was called.
BeginInit none Begins the initialization of a DataSet that is used on a form or used by another component.
Clear none Clears the DataSet of all data.
Clone none Clones the structure of the DataSet .
Copy none Copies both the structure and data for this DataSet .
Dispose none Releases the resources used by the MarshalByValueComponent.
Equals obj (Object) Determines whether the specified object is the same instance as the current object.
Equals

objA (Object)

objB (Object)

Determines if the specified object instances are equal.
GetChanges none Returns a copy of the DataSet that contains all changes made to the DataSet since it was loaded or the AcceptChanges method was called.
GetChanges rowStates (DataRowState) Returns a copy of the DataSet that contains all changes made to the DataSet since it was loaded or the AcceptChanges method was called, filtered by DataRowState .
GetHashCode none Serves as a hash function for a particular type.
GetService service (Type) Get the implementer of the IServiceProvider.
GetType none Retrieves the type of the object.
GetXml none Retrieves an xml representation of the data stored in the DataSet .
GetXmlSchema none Retrieves the XSD schema for the XML representation of the data in the DataSet .
HasChanges none Retrieves a value indicating whether the DataSet has changes.
HasChanges rowStates (DataRowState) Retrieves a value indicating whether the DataSet has changes, filtered by DataRowState .
InferXmlSchema

stream (Stream)

nsArray[] (String)

Infers the XML schema from the specified Stream object into the DataSet .
InferXmlSchema

fileName (String)

nsArray[] (String)

Infers the XML schema from the specified file into the DataSet .
InferXmlSchema

reader (TextReader)

nsArray[] (String)

Infers the XML schema from the specified TextReader into the DataSet .
InferXmlSchema

reader (XmlReader)

nsArray[] (String)

Infers the XML schema from the specified TextReader into the DataSet .
Merge rows[] (DataRow) Merges the DataSet with an array of DataRow objects.
Merge table (DataTable) Merges the DataSet with a specified DataTable .
Merge dataSet (DataSet) Merges the DataSet into a specified DataSet .
Merge

dataSet (DataSet)

preserveChanges (Boolean)

Merges the DataSet with a specified DataSet , preserving changes according to the specified argument.
Merge

rows[] (DataRow)

preserveChanges (Boolean)

missingSchemaAction (MissingSchemaAction)

Merges the DataSet with an array of DataRow objects, preserving changes, and handling incompatible schema according to the specified arguments.
Merge

dataSet (DataSet)

preserveChanges (Boolean)

missingSchemaAction (MissingSchemaAction)

Merges the DataSet with a specified DataSet , preserving changes, and handling incompatible schema according to the specified arguments.
Merge

table (DataTable)

preserveChanges (Boolean)

missingSchemaAction (MissingSchemaAction)

Merges the DataSet with a specified DataTable , preserving changes, and handling incompatible schema according to the specified arguments.
ReadXml reader (XmlReader) Reads XML schema and data into the DataSet using the specified XMLReader object.
ReadXml stream (Stream) Reads XML schema and data into the DataSet using the specified Stream object.
ReadXml reader (TextReader) Reads XML schema and data into the DataSet using the specified TextReader object.
ReadXml fileName (String) Reads XML schema and data into the DataSet using the specified file.
ReadXml

stream (Stream)

Mode (XmlReadMode)

Reads XML schema and data into the DataSet using the specified Stream and XmlReadMode.
ReadXml

fileName (String)

Mode (XmlReadMode)

Reads XML schema and data into the DataSet using the specified file and XmlReadMode.
ReadXml

reader (TextReader)

Mode (XmlReadMode)

Reads XML schema and data into the DataSet using the specified TextReader and XmlReadMode.
ReadXml

reader (XmlReader)

Mode (XmlReadMode)

Reads XML schema and data into the DataSet using the specified XmlReader and XmlReadMode.
ReadXmlSchema reader (XmlReader) Reads the XML schema into the DataSet from the specified XmlReader object.
ReadXmlSchema stream (Stream) Reads the XML schema into the DataSet from the specified Stream object.
ReadXmlSchema reader (TextReader) Reads the XML schema into the DataSet from the specified TextReader object.
ReadXmlSchema fileName (String) Reads the XML schema into the DataSet from the specified file.
RejectChanges none Rolls back all changes made to the DataSet since it was loaded or the last time the AcceptChanges method was called.
Reset none Resets the DataSet to its original state.
ToString none Returns a string that represents the current object.
WriteXml writer (XmlWriter) Writes the current schema and data for the DataSet using the specified XMLWriter object.
WriteXml fileName (String) Writes the current schema and data for the DataSet using the specified file.
WriteXml stream (Stream) Writes the current schema and data for the DataSet using the specified Stream object.
WriteXml writer (TextWriter) Writes the current schema and data for the DataSet using the specified TextWriter object.
WriteXml

stream (Stream)

mode (XmlWriteMode)

Reads XML schema and data into the DataSet using the specified XmlReader and XmlReadMode.
WriteXml

fileName (String)

mode (XmlWriteMode)

Reads XML schema and data into the DataSet using the specified XmlReader and XmlReadMode.
WriteXml

writer (TextWriter)

mode (XmlWriteMode)

Reads XML schema and data into the DataSet using the specified XmlReader and XmlReadMode.
WriteXml

writer (XmlWriter)

mode (XmlWriteMode)

Reads XML schema and data into the DataSet using the specified XmlReader and XmlReadMode.
WriteXmlSchema writer (TextWriter) Writes the DataSet structure as an XML schema to the specified TextWriter object.
WriteXmlSchema stream (Stream) Writes the DataSet structure as an XML schema to the specified Stream object.
WriteXmlSchema fileName (String) Writes the DataSet structure as an XML schema to the specified file.
WriteXmlSchema writer (XMLWriter) Writes the DataSet structure as an XML schema to the XMLWriter object.
Table B.10. DataSet Events
Name Description
MergeFailed Fires when a target and source DataRow have the same primary key value and EnforceConstraints is set to true.
Disposed Adds an event handler to listen to the Dispose event on the component.

DataTable Object Members

The DataTable class represents one table of in-memory data. Tables B.11 through B.14 list the constructor, properties, methods, and events of the DataTable class.

Table B.11. DataTable Constructor
Name Parameters Description
DataTable none Initializes a new instance of the DataTable class.
DataTable tableName (String) Initializes a new instance of the DataTable class with the specified name.
DataTable

info (SerializationInfo)

context (StreamingContext)

Initializes a new instance of the DataTable class with the SerializationInfo and StreamingContext.
Table B.12. DataTable Properties
Name Type Description
CaseSensitive Boolean Indicates whether string comparisons within the table are case sensitive.
ChildRelations Data RelationCollection Retrieves the collection of child relations for the DataTable .
Columns Data ColumnCollections Retrieves the collection of columns for the DataTable .
Constraints ConstraintCollection Retrieves the collection of constraints for the DataTable .
Container IContainer Retrieves the container for the component.
DataSet DataSet Retrieves the DataSet that the table belongs to.
DefaultView DataView Retrieves a customized view of the table.
DesignMode Boolean Retrieves a value indicating whether the component is in design mode.
DisplayExpression String Retrieves or sets the expression that will return a value used to represent the table in the UI.
ExtendedProperties PropertyCollection Retrieves the collection of customized user information.
HasErrors Boolean Retrieves a value indicating whether there are errors in any of the rows in the tables in the DataSet to which the table belongs.
Locale CultureInfo Retrieves or sets the locale information used to compare strings within the table.
MinimumCapacity Integer Retrieves or sets the initial beginning capacity for the table.
Namespace String Retrieves or sets the namespace for the DataTable .
ParentRelations Data RelationCollection Retrieves the collection of parent relations for the DataTable .
Prefix String Gets or sets the namespace for the XML representation of the data stored in the DataTable .
PrimaryKey DataColumn Retrieves or sets an array of columns that function as primary keys for the DataTable .
Rows Data RowCollection Retrieves the collection of rows that belong to this table.
Site ISite Retrieves or sets the site of the component.
TableName String Retrieves or sets the table name.
Table B.13. DataTable Methods
Name Parameters Description
AcceptChanges none Commits all changes made to this table since the last time the AcceptChanges method was called.
BeginInit none Begins the initialization of a DataTable that is used on a form or used by another component.
Clear none Clears the table of all data.
Clone none Clones the structure of the DataTable, including all schemas, relations, and constraints.
Compute

expression (String)

filter (String)

Computes the specified expression on the current rows that pass the filter criteria.
Dispose none Disposes the component.
Dispose disposing (Boolean) Releases the unmanaged resources used by the MarshalByValueComponent and optionally releases the managed resources.
EndInit none Ends the initialization of a DataTable that is used on a form or is used by another component.
Equals obj (Object) Determines whether the specified object is the same instance as the current object.
Equals

objA (Object)

objB (Object)

Determines if the specified object instances are equal.
GetChanges none Gets a copy of the DataTable that contains all the changes made to it since it was loaded or AcceptChanges was last called.
GetChanges rowState (DataRowState) Gets a copy of the DataTable that contains all the changes made to it since it was loaded or AcceptChanges was last called, filtered by DataRowState .
GetErrors none Returns an array of DataRow objects that contain errors.
GetHashCode none Serves as a hash function for a particular type.
GetService service (Type) Returns the implementer of the IServiceProvider.
GetType none Retrieves the type of the object.
ImportRow row (DataRow) Copies a DataRow , including original and current values, DataRowState values, and errors, into a DataTable .
LoadDataRow

values[] (Object)

acceptChanges (Boolean)

Finds and updates a specific row. If no matching row is found, then a new row is created using the given values.
NewRow none Creates a new DataRow with the same schema as the table.
RejectChanges none Rolls back all changes made to the table since the last time the AcceptChanges method was called.
Select none Retrieves an array of DataRow objects.
Select FilterExpression (String) Retrieves an array of DataRow objects that match the filter criteria ordered by the primary key.
Select

FilterExpression (String)

sort (String)

Retrieves an array of DataRow objects that match the filter criteria, in the specified sort order.
Select

FilterExpression (String)

sort (String)

recordState (DataViewRowState)

Retrieves an array of DataRow objects that match the filter criteria, in the specified sort order, and that match the specified state.
ToString none Returns a string that represents the current object.
Table B.14. DataTable Events
Name Description
ColumnChanged Occurs after a value has been changed for the specified DataColumn in a DataRow.
ColumnChanging Occurs when a value is changing for a specified DataColumn in a DataRow.
Disposed Adds an event handler to listen to the Disposed event on a component.
RowChanged Fires after a row value has been edited successfully.
RowChanging Fires when a value for a row is changing.
RowDeleted Fires after a row has been deleted.
RowDeleting Fires before a row in the table is about to be deleted.

DataView Object Members

The DataView class represents a databindable, customized view of a DataTable . Tables B.15 through B.18 list the constructor, properties, methods, and events for the DataView class.

Table B.15. DataView Constructor
Name Parameters Description
DataView none Initializes a new instance of the DataView class.
DataView table ( DataTable ) Initializes a new instance of the DataView class with the specified DataTable .
Table B.16. DataView Properties
Name Type Description
AllowDelete Boolean Retrieves or sets a value indicating whether deletes are allowed.
AllowEdit Boolean Retrieves or sets a value indicating whether edits are allowed.
AllowNew Boolean Retrieves or sets a value indicating whether new rows can be added.
ApplyDefaultSort Boolean Retrieves or sets a value indicating whether to use the default sort.
Container IContainer Retrieves the container for the component.
Count Integer Retrieves the number of records in the DataView after RowFilter and RowStateFilter have been applied.
DataViewManager DataViewManager Retrieves the DataView associated with this view.
DesignMode Boolean Retrieves a value indicating whether the component is currently in design mode.
Item DataRowView Retrieves a row of data from a specified table.
RowFilter String Retrieves or sets the expression used to filter which rows are viewed in the DataView .
RowStateFilter DataViewRowState Retrieves or sets the row state filter used in the DataView .
Site ISite Retrieves or sets the site of the component.
Sort String Retrieves or sets the sort column or columns and the sort order for the table.
Table DataTable Retrieves or sets the source table.
Table B.17. DataView Methods
Name Parameters Description
AddNew none Adds a new row to the DataView .
BeginInit none Begins the initialization of a DataView that is used on a form or used by another component.
Delete index (Integer) Deletes a row at the specified index.
Dispose none Disposes of the resources (other than memory) used by the DataView object.
Dispose disposing (Boolean ) Releases the unmanaged resources used by the MarshalByValueComponent and optionally releases the managed resources.
EndInit none Ends the initialization of a DataView that is used on a form or used by another component.
Equals none Determines whether the specified object is the same instance as the current object.
Equals

objA (Object)

objB (Object)

Determines if the specified object instances are equal.
Find key (Object) Finds a row in the DataView using the specified primary key value.
Find key[] (Object) Finds a row in the DataView using the specified primary key values.
GetEnumerator none Retrieves an enumerator for this DataView .
GetHashCode none Serves as a hash function for a particular type.
GetService service (Type) Gets the implementer of the IServiceProvider.
GetType none Retrieves the type of the object.
ToString none Returns a string that represents the current object.
Table B.18. DataView Events
Name Description
Disposed Adds an event handler to listen to the Disposed event on a component.
ListChanged Fires when the list managed by the DataView changes.

DataViewManager Object Members

Contains a default DataViewSettingCollection for each DataTable in a DataSet.

Table B.19. DataViewManager Constructor
Name Parameters Description
DataViewManager none Initializes a new instance of the DataViewManager class.
DataViewManager dataSet ( DataSet ) Initializes a new instance of the DataViewManger class for the specified DataSet .
Table B.20. DataViewManager Properties
Name Type Description
Container IContainer Retrieves the container for the component.
DataSet DataSet Retrieves or sets the name of the DataSet to use with the DataViewManager .
DataViewSetting-CollectionString String Retrieves or sets a value used for code persistence.
DataViewSettings DataViewSettingCollection Gets the DataViewSetting-Collection for each DataTable in the DataSet .
DesignMode Boolean Retrieves a value indicating whether the component is currently in design mode.
Site ISite Retrieves or sets the site of the component.
Table B.21. DataViewManager Methods
Name Parameters Description
CreateDataView table (DataView) Creates a DataView for the specified DataTable.
Dispose none Disposes of the resources (other than memory) used by the DataView object.
Dispose disposing (Boolean) Releases the unmanaged resources used by the MarshalByValueComponent and optionally releases the managed resources.
Equals none Determines whether the specified object is the same instance as the current object.
Equals

objA (Object)

objB (Object)

Determines if the specified object instances are equal.
GetHashCode none Serves as a hash function for a particular type.
GetService service (Type) Gets the implementer of the IServiceProvider.
GetType none Retrieves the type of the object.
ToString none Returns a string that represents the current object.
Table B.22. DataViewManager Events
Name Description
Disposed Adds an event handler to listen to the Disposed event on a component.
ListChanged Fires when a row is added or deleted from a DataView.
I l @ ve RuBoard


Asp. Net. By Example
ASP.NET by Example
ISBN: 0789725622
EAN: 2147483647
Year: 2001
Pages: 154

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net