The ADO.Net DataSet Object Part 2


by Chris Kemp - Date: 2007-01-25 - Word Count: 1010 Share This!

DataRow Class Members
Properties
Visibility
Name
Value Type
Accessibility
 
 
 
 
public
HasErrors
Boolean
[ Get ]
 
 
 
 
public
Item ( Int32 columnIndex ) ( DataRowVersion version )
Object
[ Get ]
 
 
 
 
public
Item ( DataColumn column )
Object
[ Get , Set ]
 
 
 
 
public
Item ( DataColumn column ) ( DataRowVersion version )
Object
[ Get ]
 
 
 
 
public
Item ( String columnName ) ( DataRowVersion version )
Object
[ Get ]
 
 
 
 
public
Item ( Int32 columnIndex )
Object
[ Get , Set ]
 
 
 
 
public
Item ( String columnName )
Object
[ Get , Set ]
 
 
 
 
public
ItemArray
Object
[ Get , Set ]
 
 
 
 
public
RowError
String
[ Get , Set ]
 
 
 
 
public
RowState
DataRowState
[ Get ]
 
 
 
 
public
Table
DataTable
[ Get ]
 
 
 
 

 
Methods
Visibility
Name
Parameters
Return Type
 
 
 
 
public
AcceptChanges
( )
Void
 
 
 
 
public
BeginEdit
( )
Void
 
 
 
 
public
CancelEdit
( )
Void
 
 
 
 
public
ClearErrors
( )
Void
 
 
 
 
public
Delete
( )
Void
 
 
 
 
public
EndEdit
( )
Void
 
 
 
 
public
GetChildRows
( String relationName )
DataRow
 
 
 
 
public
GetChildRows
( String relationName , DataRowVersion version )
DataRow
 
 
 
 
public
GetChildRows
( DataRelation relation , DataRowVersion version )
DataRow
 
 
 
 
public
GetChildRows
( DataRelation relation )
DataRow
 
 
 
 
public
GetColumnError
( Int32 columnIndex )
String
 
 
 
 
public
GetColumnError
( String columnName )
String
 
 
 
 
public
GetColumnError
( DataColumn column )
String
 
 
 
 
public
GetColumnsInError
( )
DataColumn
 
 
 
 
public
GetParentRow
( String relationName , DataRowVersion version )
DataRow
 
 
 
 
public
GetParentRow
( String relationName )
DataRow
 
 
 
 
public
GetParentRow
( DataRelation relation , DataRowVersion version )
DataRow
 
 
 
 
public
GetParentRow
( DataRelation relation )
DataRow
 
 
 
 
public
GetParentRows
( DataRelation relation , DataRowVersion version )
DataRow
 
 
 
 
public
GetParentRows
( DataRelation relation )
DataRow
 
 
 
 
public
GetParentRows
( String relationName , DataRowVersion version )
DataRow
 
 
 
 
public
GetParentRows
( String relationName )
DataRow
 
 
 
 
public
HasVersion
( DataRowVersion version )
Boolean
 
 
 
 
public
IsNull
( String columnName )
Boolean
 
 
 
 
public
IsNull
( DataColumn column , DataRowVersion version )
Boolean
 
 
 
 
public
IsNull
( DataColumn column )
Boolean
 
 
 
 
public
IsNull
( Int32 columnIndex )
Boolean
 
 
 
 
public
RejectChanges
( )
Void
 
 
 
 
public
SetColumnError
( Int32 columnIndex , String error )
Void
 
 
 
 
public
SetColumnError
( DataColumn column , String error )
Void
 
 
 
 
public
SetColumnError
( String columnName , String error )
Void
 
 
 
 
public
SetParentRow
( DataRow parentRow , DataRelation relation )
Void
 
 
 
 
public
SetParentRow
( DataRow parentRow )
 


The DataSet is a much more powerful and complicated object than the DataReader. The DataReader is a read-only forward-only object wherein once a record is read it is gone, unless it is saved into an array. The DataSet and DataTable objects are virtualls datasets and tables which are used in client-side operations. Though there is no ‘current record’ concept, the user is able to navigate between the rows using loops, either using the Rows collection of the DataTable object, or the DataRow object.
For i=1 to 3
tblEmployee.Rows(i)(“FirstName”)=”Daffy”
or
dim dr as DataRow=tblEmployee.Rows(i)
dr(“LastName”)=”Duck”
Next
Don’t forget that the DataSet is disconnected from the original server-side source of the data. So any changes in the DataSet will not be reflected in the source unless and until the DataSet and the Source are reconciled. You can find the status of any record by querying the RowState property of the DataRow object. The result will be one of the following: Detached, Added, Modified, Deleted, or Unchanged. Though the RowState property is read only, the DataRow has two properties which can change it: the AcceptChanges, and RejectChanges Properties.
Of further note are the DataTable.ColumnChanging, the DataTable.ColumnChanged, the DataTable.RowChanging, and the DataTable.RowChanged events which allow you to trap and code for these events within your code.
The DataView Object
The function of the DataView object is to facilitate data binding of data to Windows forms and web pages. Additionally, it can be used along with the Select method od the DataTable Object to present subsets of records from tables. Use the RowFilter property to select which records are visible, and use the Sort property to order their presentation.
DataView Class Members
Constructors
Visibility
Constructor
Parameters
 
 
 
public
DataView
( )
 
 
 
public
DataView
( DataTable table )
 
 
 
public
DataView
( DataTable table , String RowFilter , String Sort , DataViewRowState RowState )
 
 
 

Properties
Visibility
Name
Value Type
Accessibility
 
 
 
 
public
AllowDelete
Boolean
[ Get , Set ]
 
 
 
 
public
AllowEdit
Boolean
[ Get , Set ]
 
 
 
 
public
AllowNew
Boolean
[ Get , Set ]
 
 
 
 
public
ApplyDefaultSort
Boolean
[ Get , Set ]
 
 
 
 
public
Container
IContainer
[ Get ]
 
 
 
 
public
Count
Int32
[ Get ]
 
 
 
 
public
DataViewManager
DataViewManager
[ Get ]
 
 
 
 
public
DesignMode
Boolean
[ Get ]
 
 
 
 
public
Item ( Int32 recordIndex )
DataRowView
[ Get ]
 
 
 
 
public
RowFilter
String
[ Get , Set ]
 
 
 
 
public
RowStateFilter
DataViewRowState
[ Get , Set ]
 
 
 
 
public
Site
ISite
[ Get , Set ]
 
 
 
 
public
Sort
String
[ Get , Set ]
 
 
 
 
public
Table
DataTable
[ Get , Set ]
 
 
 
 

Methods
Visibility
Name
Parameters
Return Type
 
 
 
 

 

public
AddNew
( )
DataRowView
 
 
 
 
public
BeginInit
( )
Void
 
 
 
 
public
CopyTo
( Array array , Int32 index )
Void
 
 
 
 
public
Delete
( Int32 index )
Void
 
 
 
 
public
EndInit
( )
Void
 
 
 
 
public
Find
( Object key )
Int32
 
 
 
 
public
Find
( Object key )
Int32
 
 
 
 
public
FindRows
( Object key )
DataRowView
 
 
 
 
public
FindRows
( Object key )
DataRowView
 
 
 
 
public
GetEnumerator
( )
IEnumerator
 
 
 
 

Events
Multicast
Name
Type
 
 
 
multicast
Disposed
EventHandler
 
 
 
multicast
ListChanged
ListChangedEventHandler


 
Resources
Tutorial: Filtering Dataset Results
This is a useful tutorial that discusses sorting out Dataset results.
Information: Properties of files and Datasets
This resource throws light on Properties of files and Datasets


Chris Kemp is a well knoen author who writes best quality articles on IT, Software, Programming, etc. For further details please visit the site www.paladn.com Your Article Search Directory : Find in Articles

© The article above is copyrighted by it's author. You're allowed to distribute this work according to the Creative Commons Attribution-NoDerivs license.
 

Recent articles in this category:



Most viewed articles in this category: