How to select on datatable to exclude objects

  • Thread starter Thread starter Sreppohcdoow
  • Start date Start date
S

Sreppohcdoow

I.e., I want to select all rows in a datatable that don't match a
condition...

Explicitly:

myDatatable.Select("myStringColumn length > 0")

Of course, I could select them all, then check the condition afterward.. is
there a cleaner way?

Thx,
 
If your condition is "myStringColumn length > 0", is seems that you can
simply:

DataRow[] rs=myDatatable.Select("myStringColumn length = 0")

or

DataRow[] rs=myDatatable.Select("myStringColumn length <= 0")

Assume the row on that column is not nullable. Is this way of one line code
not clean enough?
 
DataRow[] rs=myDatatable.Select("myStringColumn length = 0") is not valid
syntax...

I believe it should be:
DataRow[] rs=myDatatable.Select("Len(myStringColumn) = 0")

No?


Norman Yuan said:
If your condition is "myStringColumn length > 0", is seems that you can
simply:

DataRow[] rs=myDatatable.Select("myStringColumn length = 0")

or

DataRow[] rs=myDatatable.Select("myStringColumn length <= 0")

Assume the row on that column is not nullable. Is this way of one line
code not clean enough?


Sreppohcdoow said:
I.e., I want to select all rows in a datatable that don't match a
condition...

Explicitly:

myDatatable.Select("myStringColumn length > 0")

Of course, I could select them all, then check the condition afterward..
is there a cleaner way?

Thx,
 
Back
Top