views:

108

answers:

1

Hi,

I have a byte column called 'Type' in my MS Server database. On my Asp.net page I have a ListView and a LinqDataSource. The 'Type' column is different enum flags.

I would like to check specific bits in column 'Type' in my LinqDataSource Where property.

I tried with: (Check first bit)

Type == (Type | 1)
Type = (Type | 1)
Type | 1 == Type

Type & 1 == 1
Type & 1 == 1
(Type & 1) == 1
(Type & 1) == 1

and so on...

I get two kinds of exceptions:

  • Operator incompatible with string and
  • boolean Excepted ')'

I have checked google and msdn docs without luck.

A: 

I'm using the LinqDataSource OnSelecting event now. It is not as clean though.

lasseespeholt