C# DataView.ToTable()方法


DataView.ToTable()方法及其重載:

 

1.DataView.ToTable()

根據現有DataView中的行,創建並返回一個新的DataTable。

 

2.DataView.ToTable(String)

根據現有DataView中的行,創建並返回一個新的DataTable。

參數String為返回的DataTable的名稱,輸出的表與輸入表的列相通,不可自定義。

 

3.DataView.ToTable(Boolean,String[])

根據現有DataView中的行,創建並返回一個新的DataTable。

參數Boolean的值表示是否對名稱為String[]的列內的數據進行去重處理。

如果為true,則列String[] 中沒有相同的值,為false時不去重,且默認為false。

可自定義返回的列,數組String[]為顯示返回列的集合。

例子:

          DataView dv = new DataView(table);
          table = dv.ToTable(true, "ID");              //去重,返回原表中的ID列

          //table=dv.ToTable(true,"ID","name");    //返回ID 和 name兩列

4.DataView.ToTable(String,Boolean,String[])

根據現有DataView中的行,創建並返回一個新的DataTable。

比DataView.ToTable(Boolean,String[])多一個參數,可以定義返回表的名稱。

轉載:https://blog.csdn.net/JYL15732624861/article/details/61422332?utm_source=copy


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM