Dataset select if test

T

tshad

Is there a way to do a Dataset select if test instead of having it return a
set of rows and then test the number of rows it returned?

Something like:

if ((DataSet1.Tables["Orders"].Select("name = 'tom'") > 0)
{
}

Obviously, this won't work but you get the idea. I just want to test if the
select returns any rows. If not just return.

Thanks,

Tom
 
J

Jeff Johnson

if ((DataSet1.Tables["Orders"].Select("name = 'tom'") > 0)
{
}

Does

if (DataSet1.Tables["Orders"].Select("name = 'tom'").Length > 0)
{
}

do what you want? It will still "return" the rows in an array, but it's a
temporary array which will get garbage collected, hopefully quickly.
 

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