In ADO.NET 2.0, the
DataView
Object has a new method called
ToTable
, which allows you to create a new table based on data in the
DataView
.
Here is an example that we used above that creates a new
DataTable
listing Brazilian Contact Names only:
DataView dv = new DataView(GetTable(),"Region = 'SP' and Country = 'Brazil'", "ContactName", DataViewRowState.CurrentRows);
DataTable newTable = dv.ToTable("BrazilianContactNames", true, new string[] { "ContactName" });
dataGridView1.DataSource = newTable.DefaultView;
For more details, please click here[
^]
Thanks,
Imdadhusen