Filtering a DataTable

G

Guest

I'm trying to filter a DataTable... first I do a SELECT on my DataTable...
and assign the result to a DataRow array... then I CLEAR the DataTable... and
try to import the DataRows from the DataRow array... I end up with an empty
DataTable... what am I doing wrong? And... is there a better way to do this?
 
S

Sahil Malik

The DataRow array doesn't actually copy the objects, all it does is copy the
references to the objects and gives you the array. So when you do a "Clear"
the array gets cleared too.

Use a dataview instead?

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik



MER78 said:
I'm trying to filter a DataTable... first I do a SELECT on my DataTable...
and assign the result to a DataRow array... then I CLEAR the DataTable... and
try to import the DataRows from the DataRow array... I end up with an empty
DataTable... what am I doing wrong? And... is there a better way to do
this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top