How to filter a Dataview.Rowfilter

Asked

Viewed 535 times

3

I have a Dataview and I’m trying to make a filter, where the 'photo' field is different from NULL

I tried to:

 dv.RowFilter = "foto <> ''";

But it didn’t filter. I looked here at Stackover and recommended:

dv.RowFilter = "Isnull(foto,'') <> ''";

tried as well:

dv.RowFilter = "Isnull(foto, 'Null Column') != 'Null Column'";

With: "foto <> null" it returns no result.

Same thing, no filter, in the database it returns as NULL

When I make a simple filter of the type

dv.RowFilter = "foto ='123412341234.jpg'";

works perfectly.

inserir a descrição da imagem aqui

  • I believe your problem is not in the filter, but when you make the filter

  • when I make a simple filter type: dv.Rowfilter = "photo ='123412341234.jpg'"; works perfectly.

  • So forget what I said.

  • You can put the code up to the databind part?

1 answer

4


I discovered, in fact it would be the most logical, being that it follows the standard of MS SQL. I tried doing via LINQ format and it didn’t work.

NULL ONLY

dv.RowFilter = "foto IS NULL";

Only those with registration (not null)

dv.RowFilter = "foto IS NOT NULL";

Worked perfectly.

  • 1

    The easy way out...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.