newbie dataset question

  • Thread starter Thread starter k
  • Start date Start date
K

k

I'm sure this is a simple question but i haven't been able to figure it out
.....

I load an XML file to a datatable and I want to select on multiple criteria
..... I have figured out how to select on a single criteria, but not
multiples.

I want to do something likethis SQL statement:
Select * from datatable1 where id = '1' and customername = 'Jones' and state
= 'AZ' and active = '1'.

Is there any way to do this with a datatable in C#?
Thanks
 
Hi,
I'm sure this is a simple question but i haven't been able to figure it out
....

I load an XML file to a datatable and I want to select on multiple criteria
.... I have figured out how to select on a single criteria, but not
multiples.

I want to do something likethis SQL statement:
Select * from datatable1 where id = '1' and customername = 'Jones' and state
= 'AZ' and active = '1'.

Is there any way to do this with a datatable in C#?

There is a *Select(...)* method in DataTable class which returns
*DataRow[]* as a result.

So, you can set a Select's *filterExpression* parameter to:
"id = '1' and customername = 'Jones' and state >= 'AZ' and active = '1'"

Only *LIKE* operator is different from SQL definition.

Look at: "DataColumn.Expression Property" in .NET docs.

Regards

Marcin
 
Back
Top