473,412 Members | 1,944 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,412 software developers and data experts.

bitwise comparator

I need to apply a filterparameter to a result set in my GridView based on
the selection in a DropDownList control. I want to use the integer
SelectedValue property of the DropDownList to filter the grid based on a
bitwise comparator. I could just do this in my query select statement, but
I want to cache the overall result set for faster subquery operations.

In T-SQL the bitwise comparator is the ampersand (&), but I am getting an
invalid character exception. Does anyone here know what the .NET compiler
might accept for this type of operation?
Nov 19 '05 #1
2 2298
Random wrote:
I need to apply a filterparameter to a result set in my GridView
based on the selection in a DropDownList control. I want to use the
integer SelectedValue property of the DropDownList to filter the grid
based on a bitwise comparator. I could just do this in my query
select statement, but I want to cache the overall result set for
faster subquery operations.
In T-SQL the bitwise comparator is the ampersand (&), but I am
getting an invalid character exception. Does anyone here know what
the .NET compiler might accept for this type of operation?


SelectedValue is a *string*, although in your particular case those strings
might contain only digits. You have to use Int32.Parse to convert it
into a real int, where you can use the "&" operator on (at least in C#,
you didn't specify a language).

Hans Kesting
Nov 19 '05 #2
I'm using VB.NET, but I don't think that should be an issue.

The problem is actually a little more complicated than what I briefly stated
before. I found a bug in .NET that won't allow me to apply more than one
type of FilterParameter to my ObjectDataSource (asp:QueryStringParameter and
asp:ControlParameter don't play nice together)... so instead I'm applying
the filter programmatically by explicity setting the FilterExpression
according to the control values.

So, on Page_Load, if the DropDownList has a SelectedValue, I write...

MyObjDataSource.FilterExpression = "(involveSM & " &
MyDropDown.SelectedValue & ") = " & MyDropDown.SelectedValue

"involveSM" is the column name in the dataset holding the integer values I
want to compare against. So, if the SelectedValue from the DropDownList is
"32", the FilterExpression should then read...

"(involveSM & 32) = 32"

I realize there are better ways to do this string operation, but I'm just
trying to get it to work first. But you can see, by doing this, that the
actual data type shouldn't be an issue, the compiler just has to evaluate
the FilterExpression.

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:uy**************@TK2MSFTNGP15.phx.gbl...
Random wrote:
I need to apply a filterparameter to a result set in my GridView
based on the selection in a DropDownList control. I want to use the
integer SelectedValue property of the DropDownList to filter the grid
based on a bitwise comparator. I could just do this in my query
select statement, but I want to cache the overall result set for
faster subquery operations.
In T-SQL the bitwise comparator is the ampersand (&), but I am
getting an invalid character exception. Does anyone here know what
the .NET compiler might accept for this type of operation?


SelectedValue is a *string*, although in your particular case those
strings
might contain only digits. You have to use Int32.Parse to convert it
into a real int, where you can use the "&" operator on (at least in C#,
you didn't specify a language).

Hans Kesting

Nov 19 '05 #3

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

Similar topics

7
by: Christopher Jeris | last post by:
I am relatively new to JavaScript, though not to programming, and I'm having trouble finding the idiomatic JS solution to the following problem. I have a table with (say) fields f1, f2, f3. I...
2
by: Steven T. Hatton | last post by:
While thunbing through _C++ Templates, The Complete Guide_ (reckon I aught to read it?) I came across a discussion of using templates to "unroll" loops. I thought that looked like a good idea, so...
17
by: Trent Buck | last post by:
The fourth argument is a comparator that returns `an integer less than, equal to, or greater than zero' depending on the ordering of its arguments. If I don't care about the order and simply...
6
by: jas_lx | last post by:
The basic understanding of what bitwise operators (& ^ | >> << ) comes fairly simple, as long as one has a fundamental understanding of bits, bytes and binary. Having done some Win32...
2
by: Steve Summit | last post by:
-----BEGIN PGP SIGNED MESSAGE----- It's often explained that the reason for some of the imprecision in C's definition is so that C can be implemented on different kinds of machines -- say, those...
9
by: Christopher Weaver | last post by:
I know that the bitwise AND of 8 and 4 will return 0 or false and the bitwise AND of 8 and 9 will return 1 or true but I don't know how to write the synax for it in C#. I have a value that ranges...
5
by: noridotjabi | last post by:
I'm learning to program in C and any tutorial or book that I read likes to briefly touch on birdies operators and then move on without giving any sort of example application of them. Call me what...
5
by: Gigs_ | last post by:
Can someone explain me bitwise expression? few examples for every expression will be nice x << y Left shift x >y Right shift x & y Bitwise AND x | y Bitwise OR x ^ y Bitwise XOR (exclusive...
6
by: furqan shaikh | last post by:
hi can any one help me in making the c++ files comparator. i m in data structure course and i am gonna make project on c++ code comparator. plz help me in making it.
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.