create new DataTable

  • Thread starter Thread starter John
  • Start date Start date
J

John

What is the most efficient way to perform a filter on a
DataTable and then have a new DataTable with only the
rows matching the filter?

The only thing I can think of is the following:

1. dataTableNew = dataTableOld.Clone();
2. rows = dataTableOld.Select("some filter");
3. loop through rows and add to dataTableNew

A few step left out, but you get the idea.

Would love to hear your thoughts,
John
 
* "John said:
What is the most efficient way to perform a filter on a
DataTable and then have a new DataTable with only the
rows matching the filter?

The only thing I can think of is the following:

1. dataTableNew = dataTableOld.Clone();
2. rows = dataTableOld.Select("some filter");
3. loop through rows and add to dataTableNew

A few step left out, but you get the idea.

Your question is not related to Windows Forms programming, I recommend
to post it to this group:

<URL:
Web interface:

<URL:http://msdn.microsoft.com/newsgroups/?dg=microsoft.public.dotnet.framework.adonet>
 
Back
Top