|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to select on datatable to exclude objectsI.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? Show quote "Sreppohcdoow" <Sreppohcd***@asdf.com> wrote in message news:u1%23pRE%23YGHA.3752@TK2MSFTNGP03.phx.gbl... > 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, > DataRow[] rs=myDatatable.Select("myStringColumn length = 0") is not valid
syntax... I believe it should be: DataRow[] rs=myDatatable.Select("Len(myStringColumn) = 0") No? Show quote "Norman Yuan" <NotR***@NotReal.not> wrote in message news:up6T4h%23YGHA.4688@TK2MSFTNGP04.phx.gbl... > 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" <Sreppohcd***@asdf.com> wrote in message > news:u1%23pRE%23YGHA.3752@TK2MSFTNGP03.phx.gbl... >> 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, >> > > |
|||||||||||||||||||||||