473,398 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

how to get around using "&" in Filter Expressions

I really need to use the "&" logical operator on a data column when using
FilterRow, but apparantly the filter expressions do not support this. Is
there any workaround for this?
Nov 16 '05 #1
4 3785
Is this what you're looking for:

DataView dv = new DataView();
dv.Table = <table>;
dv.RowFilter = "Field1=??? and Field2=???";

The RowFilter property of the DataView class and the Select() method of the
DataTable class share syntax with SQL.

"MrNobody" <Mr******@discussions.microsoft.com> wrote in message
news:37**********************************@microsof t.com...
I really need to use the "&" logical operator on a data column when using
FilterRow, but apparantly the filter expressions do not support this. Is
there any workaround for this?

Nov 16 '05 #2
Dave, thank you for your reply!

That is not quite what I was looking for.

What I need is to do a bitwise AND operation on a number stored in the
DataTable.

So say the number is 144 and we're concerned with 8 bits.

I need to know if the 8th but is high (128 is 1)

Normally this is an easy expression: 144 & 128 > 0

but without that operator I need to know a workaround
Nov 16 '05 #3
Sorry! I read "Data Table" and "FilterRow" and just thought you left out an
"&," I'm afraid I can't be of much help on this one.

Good luck!

"MrNobody" <Mr******@discussions.microsoft.com> wrote in message
news:5B**********************************@microsof t.com...
Dave, thank you for your reply!

That is not quite what I was looking for.

What I need is to do a bitwise AND operation on a number stored in the
DataTable.

So say the number is 144 and we're concerned with 8 bits.

I need to know if the 8th but is high (128 is 1)

Normally this is an easy expression: 144 & 128 > 0

but without that operator I need to know a workaround

Nov 16 '05 #4
"MrNobody" <Mr******@discussions.microsoft.com> wrote in message
news:37**********************************@microsof t.com...
I really need to use the "&" logical operator on a data column when using
FilterRow, but apparantly the filter expressions do not support this. Is
there any workaround for this?


The SQL interpreter build into .Net (used by FilterRow) may not
recognize bitwise &, but TransactSQL does (and presumably what ever data
server you are using does).

So, on your initial query, include a new column which has the data
manipulated as you desired:

Instead of:
Select A,B,C from MyTable"
use
Select A,B,C, (A & 128) as D from MyTable"

Then the RowFilter merely becomes "D > 0"

--
Truth,
James Curran
[erstwhile VC++ MVP]
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David Furey | last post by:
Hi I have an XML documnet and a XSLT document as shown below THe XSLT document brings back a filtered docmument that has the VendorName that starts with a particular sub-string This works as...
5
by: Michael Hill | last post by:
I have a general question about how people generally tend to deal with users data that they enter. As an example users enter double quotes in a text field surrounding a specific piece of text...
6
by: vigi98 | last post by:
Hello all, Can someone confirme that this: var strURLpiece = "UK & Ireland"; strURLpiece.replace("&", "%26"); replaces all occurrence of the character & by %26 in strURLpiece, ie that...
2
by: Eric Osman | last post by:
Hi, I'm looking for a javascript function that will convert input such as this: <CLUB Code=" into this: &lt;CLUB Code=&quot;
4
by: barney | last post by:
Hello, I' m using .NET System.Xml.XmlDOcument. When I do the following: XmlDocument xml = new XmlDocument(); xml.Load("blah"); .... xml.Save("blub"); I've got the problem that the following...
5
by: martin | last post by:
Hi, I would be extremly grateful for some help on producing an xml fragemt. The fragment that I wish to produce should look like this <Addresses> <Address>&qout;Somebody's Name&quot;...
3
by: pw | last post by:
Hi, I created and distributed an Access 2003 MDE. When the user opens up a form he get's an error message :Function is not available in expressions in query expression 'Trim( & ", " & )'. ...
1
by: Amith | last post by:
Here we are facing a problem which is when we pass a parameter to javascript putting '&' . Ex: &contact. In Japanese OS when we receive this parameter in the script '&' is converted to 'e'.So...
2
nev
by: nev | last post by:
Does anyone know how to do that? In my real project actually, I filter on two fields like this... bindingsource.filter = "col1='" & var1 & "' AND col2='" & var2 & "'" wherein var1 or var2 may...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.