A DataView object can be used to export data from one DataTable object to another. This will be especially useful when a user-defined set of filters is applied and the user wants to convert the view that is seen into a new data table. Exporting to a new data table is done with the DataView object’s ToTable method, For e.g.
DataTable export = view.ToTable(
"MyTable", true, "CoulmnA", "ColumnB", "ColumnC");
This code sample exports the data seen through the data view called “view” to a new
DataTable object named export. Note that the name of this table is “MyTable”. Passingtrue for the distinct parameter indicates that only distinct values are kept (which filter out duplicate values). If false is used, all values should be shown. The names of the columns to include in the new table are then passed to the method.
Wednesday, 18 July 2012
Export DataView to DataTable
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment