RowFilter Question

R

Ron Ward

In SQL Server, I can have the following statement:

select * from MyTable where (MyColumn & 0x0001) = 1

Basically any row with a 1 or a 3 in the MyColumn will return on this call.
If I load the entire table into a DataTable object and then attempt this
same filter by setting the RowFilter property:

oDataTable.DefaultView.RowFilter = "(MyColumn & 0x0001) = 1";

I get an error: System.Data.SyntaxErrorException: Cannot interpret token '0'

Is the bitwise operator invalid on the RowFilter property, or do I need to
set this property differently?

Thank you in advance...-Ron Ward
 
C

Cor Ligthert [MVP]

Ron,

I don't understand why you expect that an expression (a kind of scripting on
its own) should be the same as SQL scripting?

You cannot use JScript or VBS statements too in those expressions.

Cor
 
M

Miha Markic [MVP C#]

Hi Ron,

I doubt that bitwise and operator is implemented.
To check what is supported take a look at
DataColumn.Expression Property
..net help topic.
 
C

Cor Ligthert [MVP]

Miha,

Doh,

Beside that why would the selection of columns than go in the way SQL does
it?

Cor
 
R

Ron Ward

Thanks for the comments. I just believed the RowFilter would support
anything you ca put in a SQL Where clause. To this point I hadn't found
anything it wouldn't support: the LIKE clause the NOT clause and the IN
clause all work. I was just hoping that was the case but based on the
responses it appears it does not. Thanks for answering though.

-Ron
 
R

Ron Ward

I hate to sound rude, but if you don't have anything helpful to contribute,
perhaps you should just remain quiet.
 
C

Cor Ligthert [MVP]

Ron,
I hate to sound rude, but if you don't have anything helpful to contribute,
perhaps you should just remain quiet.
May I ask you what is the helpful part in your message?
I was giving an reply to Miha not to you.
I thought that this was a community newsgroup to learn from each other.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top