DataView disposable

DataView disposable

System.Data (system.data.dll) class

The DataView represents a custom view of a DataTable that can be bound to controls. It allows you to apply row sorting and filtering without affecting the underlying data. All DataTable binding takes place through a DataView . When you bind to a DataTable object, you are actually binding to the DataTable.DefaultView , which is an automatically created DataView object. You can configure this DataView or create a new DataView . In fact, you can even create multiple DataView objects for the same DataTable and use them to display different views of the same data in different user interface controls.

Some significant properties of the DataView are Sort , RowFilter , and RowStateFilter . Sort is a SQL expression that sets column-based sorting (as in CustomerID ASC ). RowFilter is a SQL expression that works like a WHERE clause, including only rows that match certain criteria (such as CustomerID > 100 ). Finally, RowStateFilter shows only rows that have a specified DataViewRowState . For more information about the DataView objects and the syntax you can use to filter and sort data within them, refer to Chapter 28. Much as with a Data-Table , you can add new rows (using AddNew( ) ) and select existing ones (using Find( ) ) through a DataView .

 public class  DataView  : System.ComponentModel.MarshalByValueComponent ,  System.ComponentModel.IBindingList, IList, ICollection, IEnumerable, System.ComponentModel.ITypedList,  System.ComponentModel.ISupportInitialize {  // Public Constructors  public  DataView  (  );      public  DataView  ( DataTable   table   );      public  DataView  (DataTable   table   , string   RowFilter   , string   Sort   , DataViewRowState   RowState   );  // Public Instance Properties  public bool  AllowDelete  {set; get; }     public bool  AllowEdit  {set; get; }  // implements System.ComponentModel.IBindingList  public bool  AllowNew  {set; get; }  // implements System.ComponentModel.IBindingList  public bool  ApplyDefaultSort  {set; get; }     public int  Count  {get; }  // implements ICollection  public DataViewManager  DataViewManager  {get; }     public virtual string  RowFilter  {set; get; }     public DataViewRowState  RowStateFilter  {set; get; }     public string  Sort  {set; get; }     public DataTable  Table  {set; get; }     public DataRowView  this[int    recordIndex    ]  {get; }  // Protected Instance Properties  protected bool  IsOpen  {get; }  // Public Instance Methods  public virtual DataRowView  AddNew  (  );      public void  BeginInit  (  );  // implements System.ComponentModel.ISupportInitialize  public void  CopyTo  ( Array   array   , int   index   );  // implements ICollection  public void  Delete  ( int   index   );      public void  EndInit  (  );  // implements System.ComponentModel.ISupportInitialize  public int  Find  ( object   key   );      public int  Find  ( object[ ]   key   );      public DataRowView[ ]  FindRows  ( object   key   );      public DataRowView[ ]  FindRows  ( object[ ]   key   );      public IEnumerator  GetEnumerator  (  );  // implements IEnumerable   // Protected Instance Methods  protected void  Close  (  );      protected virtual void  ColumnCollectionChanged  (object   sender   , System.ComponentModel.CollectionChangeEventArgs   e   );    protected override void  Dispose  ( bool   disposing   );  // overrides System.ComponentModel.MarshalByValueComponent  protected virtual void  IndexListChanged  (object   sender   , System.ComponentModel.ListChangedEventArgs   e   );    protected virtual void  OnListChanged  (System.ComponentModel.ListChangedEventArgs   e   );    protected void  Open  (  );      protected void  Reset  (  );      protected void  UpdateIndex  (  );      protected virtual void  UpdateIndex  ( bool   force   );  // Events  public event ListChangedEventHandler  ListChanged  ;  // implements System.ComponentModel.IBindingList  } 

Hierarchy

System.Object figs/u2192.gif System.ComponentModel.MarshalByValueComponent(System.ComponentModel.IComponent, System.IDisposable , System.IServiceProvider) figs/u2192.gif DataView(System.ComponentModel.IBindingList, System.Collections.IList , System.Collections.ICollection , System.Collections.IEnumerable , System.ComponentModel.ITypedList , System.ComponentModel.ISupportInitialize)

Returned By

DataRowView.{CreateChildView( ) , DataView} , DataTable.DefaultView , DataViewManager.CreateDataView( )



ADO. NET in a Nutshell
ADO.NET in a Nutshell
ISBN: 0596003617
EAN: 2147483647
Year: 2005
Pages: 415

Similar book on Amazon

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