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

datatable.select problem

Hi, I use datatable.select to select row in a table in a dataset. I use an
ampersand in the selectstring and get an error that it is unsupported. The
statement works fine in the query analyzer of enterprise manager.
select is like: '1 & val2'
I use the & to have a binary AND comparison=to check if bit 0 of val2 is
set.
Do I make a mistake? Is there a workaround?
Thanks
Frank
Nov 17 '05 #1
9 6580
The syntax for a DataTable.Select criteria is the same as for the
DataColumn.Expression property and is detailed under that heading.

My interpretation is that there is a boolean AND operator but bitwise
operators are not supported.
"Frank" <fr***@frank.com> wrote in message
news:42*********************@news.xs4all.nl...
Hi, I use datatable.select to select row in a table in a dataset. I use an
ampersand in the selectstring and get an error that it is unsupported. The
statement works fine in the query analyzer of enterprise manager.
select is like: '1 & val2'
I use the & to have a binary AND comparison=to check if bit 0 of val2 is
set.
Do I make a mistake? Is there a workaround?
Thanks
Frank

Nov 17 '05 #2
Stephany, thanks for a very fast answer. I will solve it with a function in
the sqlserver db.
Frank
"Stephany Young" <noone@localhost> schreef in bericht
news:eo*************@tk2msftngp13.phx.gbl...
The syntax for a DataTable.Select criteria is the same as for the
DataColumn.Expression property and is detailed under that heading.

My interpretation is that there is a boolean AND operator but bitwise
operators are not supported.
"Frank" <fr***@frank.com> wrote in message
news:42*********************@news.xs4all.nl...
Hi, I use datatable.select to select row in a table in a dataset. I use
an ampersand in the selectstring and get an error that it is unsupported.
The statement works fine in the query analyzer of enterprise manager.
select is like: '1 & val2'
I use the & to have a binary AND comparison=to check if bit 0 of val2 is
set.
Do I make a mistake? Is there a workaround?
Thanks
Frank


Nov 17 '05 #3
Stephany,I interpreted the select command wrong. After reading the doc about
the expression. A sqlserver function of course does not solve the problem.
I have indeed need bitwise comparison and I can't find something about that.
Frank
"Frank" <fr***@frank.com> schreef in bericht
news:42*********************@news.xs4all.nl...
Stephany, thanks for a very fast answer. I will solve it with a function
in the sqlserver db.
Frank
"Stephany Young" <noone@localhost> schreef in bericht
news:eo*************@tk2msftngp13.phx.gbl...
The syntax for a DataTable.Select criteria is the same as for the
DataColumn.Expression property and is detailed under that heading.

My interpretation is that there is a boolean AND operator but bitwise
operators are not supported.
"Frank" <fr***@frank.com> wrote in message
news:42*********************@news.xs4all.nl...
Hi, I use datatable.select to select row in a table in a dataset. I use
an ampersand in the selectstring and get an error that it is
unsupported. The statement works fine in the query analyzer of
enterprise manager.
select is like: '1 & val2'
I use the & to have a binary AND comparison=to check if bit 0 of val2 is
set.
Do I make a mistake? Is there a workaround?
Thanks
Frank



Nov 17 '05 #4
Frank,

Not that I ever tried that, however in your case would I try to add an extra
column using a bitwise expression and than use the Select to test that
column.

I hope this helps,

Cor
Nov 17 '05 #5
From the context of your original post, I assume that val2 is an integral
type.

Try "... (val2 % 2 = 1)" for IsBit0Set and "... (val2 % 2 = 0)" for
IsBit0Reset

If bit0 is set then the value is always odd so modulus 2 will always give a
result of 1.

If the result os zero then the value is even therefore bit0 is reset.

The modulus (%) operator is specificailly listed in the
DataColumn.Expression details that I referred you to earlier.
"Frank" <fr***@frank.com> wrote in message
news:42*********************@news.xs4all.nl...
Stephany,I interpreted the select command wrong. After reading the doc
about the expression. A sqlserver function of course does not solve the
problem.
I have indeed need bitwise comparison and I can't find something about
that.
Frank
"Frank" <fr***@frank.com> schreef in bericht
news:42*********************@news.xs4all.nl...
Stephany, thanks for a very fast answer. I will solve it with a function
in the sqlserver db.
Frank
"Stephany Young" <noone@localhost> schreef in bericht
news:eo*************@tk2msftngp13.phx.gbl...
The syntax for a DataTable.Select criteria is the same as for the
DataColumn.Expression property and is detailed under that heading.

My interpretation is that there is a boolean AND operator but bitwise
operators are not supported.
"Frank" <fr***@frank.com> wrote in message
news:42*********************@news.xs4all.nl...
Hi, I use datatable.select to select row in a table in a dataset. I use
an ampersand in the selectstring and get an error that it is
unsupported. The statement works fine in the query analyzer of
enterprise manager.
select is like: '1 & val2'
I use the & to have a binary AND comparison=to check if bit 0 of val2
is set.
Do I make a mistake? Is there a workaround?
Thanks
Frank



Nov 17 '05 #6
Great idea!!!!
Thanks again
Frank

"Stephany Young" <noone@localhost> schreef in bericht
news:um**************@TK2MSFTNGP10.phx.gbl...
From the context of your original post, I assume that val2 is an integral
type.

Try "... (val2 % 2 = 1)" for IsBit0Set and "... (val2 % 2 = 0)" for
IsBit0Reset

If bit0 is set then the value is always odd so modulus 2 will always give
a result of 1.

If the result os zero then the value is even therefore bit0 is reset.

The modulus (%) operator is specificailly listed in the
DataColumn.Expression details that I referred you to earlier.
"Frank" <fr***@frank.com> wrote in message
news:42*********************@news.xs4all.nl...
Stephany,I interpreted the select command wrong. After reading the doc
about the expression. A sqlserver function of course does not solve the
problem.
I have indeed need bitwise comparison and I can't find something about
that.
Frank
"Frank" <fr***@frank.com> schreef in bericht
news:42*********************@news.xs4all.nl...
Stephany, thanks for a very fast answer. I will solve it with a function
in the sqlserver db.
Frank
"Stephany Young" <noone@localhost> schreef in bericht
news:eo*************@tk2msftngp13.phx.gbl...
The syntax for a DataTable.Select criteria is the same as for the
DataColumn.Expression property and is detailed under that heading.

My interpretation is that there is a boolean AND operator but bitwise
operators are not supported.
"Frank" <fr***@frank.com> wrote in message
news:42*********************@news.xs4all.nl...
> Hi, I use datatable.select to select row in a table in a dataset. I
> use an ampersand in the selectstring and get an error that it is
> unsupported. The statement works fine in the query analyzer of
> enterprise manager.
> select is like: '1 & val2'
> I use the & to have a binary AND comparison=to check if bit 0 of val2
> is set.
> Do I make a mistake? Is there a workaround?
> Thanks
> Frank
>



Nov 17 '05 #7
No, thats still not the solution. If an int contains 3 (bit 0 and 1 set)
then mod does not give the correct answer. I will have to resort to columns
with the respective bitvalues in them.
Frank
"Stephany Young" <noone@localhost> schreef in bericht
news:um**************@TK2MSFTNGP10.phx.gbl...
From the context of your original post, I assume that val2 is an integral
type.

Try "... (val2 % 2 = 1)" for IsBit0Set and "... (val2 % 2 = 0)" for
IsBit0Reset

If bit0 is set then the value is always odd so modulus 2 will always give
a result of 1.

If the result os zero then the value is even therefore bit0 is reset.

The modulus (%) operator is specificailly listed in the
DataColumn.Expression details that I referred you to earlier.
"Frank" <fr***@frank.com> wrote in message
news:42*********************@news.xs4all.nl...
Stephany,I interpreted the select command wrong. After reading the doc
about the expression. A sqlserver function of course does not solve the
problem.
I have indeed need bitwise comparison and I can't find something about
that.
Frank
"Frank" <fr***@frank.com> schreef in bericht
news:42*********************@news.xs4all.nl...
Stephany, thanks for a very fast answer. I will solve it with a function
in the sqlserver db.
Frank
"Stephany Young" <noone@localhost> schreef in bericht
news:eo*************@tk2msftngp13.phx.gbl...
The syntax for a DataTable.Select criteria is the same as for the
DataColumn.Expression property and is detailed under that heading.

My interpretation is that there is a boolean AND operator but bitwise
operators are not supported.
"Frank" <fr***@frank.com> wrote in message
news:42*********************@news.xs4all.nl...
> Hi, I use datatable.select to select row in a table in a dataset. I
> use an ampersand in the selectstring and get an error that it is
> unsupported. The statement works fine in the query analyzer of
> enterprise manager.
> select is like: '1 & val2'
> I use the & to have a binary AND comparison=to check if bit 0 of val2
> is set.
> Do I make a mistake? Is there a workaround?
> Thanks
> Frank
>



Nov 17 '05 #8
Que? What math school did you go to?

3 is both bit1 and bit0 set - (11) - and, for an integer, 3 mod 2 = 1 in
anybody's language.

"Frank" <fr***@frank.com> wrote in message
news:d2**********@news6.zwoll1.ov.home.nl...
No, thats still not the solution. If an int contains 3 (bit 0 and 1 set)
then mod does not give the correct answer. I will have to resort to
columns with the respective bitvalues in them.
Frank
"Stephany Young" <noone@localhost> schreef in bericht
news:um**************@TK2MSFTNGP10.phx.gbl...
From the context of your original post, I assume that val2 is an
integral type.

Try "... (val2 % 2 = 1)" for IsBit0Set and "... (val2 % 2 = 0)" for
IsBit0Reset

If bit0 is set then the value is always odd so modulus 2 will always give
a result of 1.

If the result os zero then the value is even therefore bit0 is reset.

The modulus (%) operator is specificailly listed in the
DataColumn.Expression details that I referred you to earlier.
"Frank" <fr***@frank.com> wrote in message
news:42*********************@news.xs4all.nl...
Stephany,I interpreted the select command wrong. After reading the doc
about the expression. A sqlserver function of course does not solve the
problem.
I have indeed need bitwise comparison and I can't find something about
that.
Frank
"Frank" <fr***@frank.com> schreef in bericht
news:42*********************@news.xs4all.nl...
Stephany, thanks for a very fast answer. I will solve it with a
function in the sqlserver db.
Frank
"Stephany Young" <noone@localhost> schreef in bericht
news:eo*************@tk2msftngp13.phx.gbl...
> The syntax for a DataTable.Select criteria is the same as for the
> DataColumn.Expression property and is detailed under that heading.
>
> My interpretation is that there is a boolean AND operator but bitwise
> operators are not supported.
>
>
> "Frank" <fr***@frank.com> wrote in message
> news:42*********************@news.xs4all.nl...
>> Hi, I use datatable.select to select row in a table in a dataset. I
>> use an ampersand in the selectstring and get an error that it is
>> unsupported. The statement works fine in the query analyzer of
>> enterprise manager.
>> select is like: '1 & val2'
>> I use the & to have a binary AND comparison=to check if bit 0 of val2
>> is set.
>> Do I make a mistake? Is there a workaround?
>> Thanks
>> Frank
>>
>
>



Nov 17 '05 #9
yesyes, but the mod function gives back the wrong answer.
Consider: bit 0 and 2 set = 5
5 mod 2 = 1
bit 0,1 and 2 set = 7
7 mod 2 = 1
Twice a mod not equal 0
and bit 1 is set differently. Frank
"Stephany Young" <noone@localhost> schreef in bericht
news:O8*************@TK2MSFTNGP15.phx.gbl...
Que? What math school did you go to?

3 is both bit1 and bit0 set - (11) - and, for an integer, 3 mod 2 = 1 in
anybody's language.

"Frank" <fr***@frank.com> wrote in message
news:d2**********@news6.zwoll1.ov.home.nl...
No, thats still not the solution. If an int contains 3 (bit 0 and 1 set)
then mod does not give the correct answer. I will have to resort to
columns with the respective bitvalues in them.
Frank
"Stephany Young" <noone@localhost> schreef in bericht
news:um**************@TK2MSFTNGP10.phx.gbl...
From the context of your original post, I assume that val2 is an
integral type.

Try "... (val2 % 2 = 1)" for IsBit0Set and "... (val2 % 2 = 0)" for
IsBit0Reset

If bit0 is set then the value is always odd so modulus 2 will always
give a result of 1.

If the result os zero then the value is even therefore bit0 is reset.

The modulus (%) operator is specificailly listed in the
DataColumn.Expression details that I referred you to earlier.
"Frank" <fr***@frank.com> wrote in message
news:42*********************@news.xs4all.nl...
Stephany,I interpreted the select command wrong. After reading the doc
about the expression. A sqlserver function of course does not solve the
problem.
I have indeed need bitwise comparison and I can't find something about
that.
Frank
"Frank" <fr***@frank.com> schreef in bericht
news:42*********************@news.xs4all.nl...
> Stephany, thanks for a very fast answer. I will solve it with a
> function in the sqlserver db.
> Frank
> "Stephany Young" <noone@localhost> schreef in bericht
> news:eo*************@tk2msftngp13.phx.gbl...
>> The syntax for a DataTable.Select criteria is the same as for the
>> DataColumn.Expression property and is detailed under that heading.
>>
>> My interpretation is that there is a boolean AND operator but bitwise
>> operators are not supported.
>>
>>
>> "Frank" <fr***@frank.com> wrote in message
>> news:42*********************@news.xs4all.nl...
>>> Hi, I use datatable.select to select row in a table in a dataset. I
>>> use an ampersand in the selectstring and get an error that it is
>>> unsupported. The statement works fine in the query analyzer of
>>> enterprise manager.
>>> select is like: '1 & val2'
>>> I use the & to have a binary AND comparison=to check if bit 0 of
>>> val2 is set.
>>> Do I make a mistake? Is there a workaround?
>>> Thanks
>>> Frank
>>>
>>
>>
>
>



Nov 17 '05 #10

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

Similar topics

8
by: Buddy | last post by:
Hello, We are using DataTable to store our data that we retrieve from SQL because it provides us with ROW/COLUMN concept. Due to DataTable been memory hungary we are finding that at least 40MB...
5
by: Stefan Turalski \(stic\) | last post by:
Hi, I'm wondering if there is a way to send a method parametrs by ref when DataTabel is a type of this value ? I done some sort of select over DataTable columns, just by removing them froma...
4
by: Kris Rudin | last post by:
I am displaying a table of information on a web page, using an asp:table that I populate dynamically. On this page I give the user the options to group the rows by certain fields, and/or filter the...
0
by: Chris Ericoli | last post by:
Hi, I am working with an 'in session' ado dataset with an asp.net application. My dataset is comprised of two tables, one of which maintains a few calculated datacolumns. For some reason these...
3
by: emailtonitin | last post by:
Hi, I am having a problem with the default sorting mechanism employed by the datatable.select method - I have a datatable having rows (simplified for clarity) - name ----- c a
12
by: Doug Bell | last post by:
Hi, I am having problems trying to create a (temporary) DataTable from a selection from a DataGrid (dgOrders). dtOrdDetails is declared as a Public DataTable Sub is: Dim stFilter as String...
4
by: Aryan | last post by:
Hi, I am having problem with DataTable.Select() method. I am using ASP.NET 2.0. I have DataSet which reads data from XML file using DataSet.ReadXML(). Now this dataset has various datatable,...
6
by: Pete Wittig | last post by:
Hi, I have a DataTable and I want to get a subset of the rows within it. I use the Select method to get my subset and the results are in a DataRow. I want to put those Rows back into a...
13
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
I want to create a new column in a datatable from two existing columns. I have no problem to create the new column using the datatable.columns.add method. The problem is the value of the new...
3
by: Jeff | last post by:
hey ..NET 2.0 I have a datatable which consist of 3 columns (int, date, value). This DataTable have 3 rows, the values of the "date" ("date" column is of datetime datatype) column is:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...

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.