Re: Manually adding to DataView / Custom RowFilter

Tech-Archive recommends: Fix windows errors by optimizing your registry



Mike,

For Net 1.x versions
\\\
DataView dv = new DataView(dt);
dv.Sort = "bla"; // sorts column bla
DataTable dtnew = dt.Clone();
foreach (DataRowView dvr in dv)
dtnew.ImportRow(dvr.Row);
dt.Clear();
dt = dtnew.Copy();
///

In the Net 2 version there is a CopyTo command to copy it in one time to a
new datatable.

I hope this helps,

Cor


.



Relevant Pages

  • Re: Sorting dataset Columns
    ... DataView dv = new DataView; ... DataTable dtnew = dt.Clone; ... foreach (DataRowView dvr in dv) ...
    (microsoft.public.dotnet.general)
  • Re: Saving a dataview to a new dataset in C#
    ... I typed it in this message, so watch typos or other errors. ... DataTable dtnew = dt.Clone; ... foreach (DataRowView dvr in dt.DefaultView) ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: DataView and DataViewRows
    ... DataView dv = new DataView; ... DataTable dtnew = dt.Clone; ... foreach (DataRowView dvr in dv) ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Sorting problem
    ... DataTable dtnew = dt.Clone; ... foreach (DataRowView dvr in dv) ... Cor ...
    (microsoft.public.dotnet.languages.csharp)