程式碼中使用DataView物件----建立DataView物件

asword發表於2007-06-14
動態生成dataview,對dataset起過濾和排序作用[@more@]建立DataView物件

DataTable tbl=new DataTable("table1");

DataView dv;

dv=new DataView();

dv.Table=tbl;

dv=new DataView(tbl);

//-----------------------------------------------------------------------

DataView還有一個建構函式

DataTable tbl=new DataTable("Customers");

DataViewRowState dvrs;

dvrs=DataViewRowState.ModifiedOriginal Or DataViewRowState.Deleted;

DataView dv;

dv=new DataView();

dv.Table=tbl;

dv.RowFilter="Country= 'USA' ";

dv.Sort="City DESC";

dv.RowStateFilter=dvrs;

dv=new DataView(tbl,"Country= 'USA' ","City DESC",drvs);

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/82387/viewspace-918845/,如需轉載,請註明出處,否則將追究法律責任。

相關文章