Home All Groups Group Topic Archive Search About

datatable.select problem

Author
2 Apr 2005 7:33 AM
Frank
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

Author
2 Apr 2005 8:02 AM
Stephany Young
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.


Show quote
"Frank" <fr***@frank.com> wrote in message
news:424e4a33$0$146$e4fe514c@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
>
Author
2 Apr 2005 8:42 AM
Frank
Stephany, thanks for a very fast answer. I will solve it with a function in
the sqlserver db.
Frank
Show quote
"Stephany Young" <noone@localhost> schreef in bericht
news:eo4eap1NFHA.244@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:424e4a33$0$146$e4fe514c@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
>>
>
>
Author
2 Apr 2005 9:11 AM
Frank
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
Show quote
"Frank" <fr***@frank.com> schreef in bericht
news:424e5a5f$0$150$e4fe514c@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:eo4eap1NFHA.244@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:424e4a33$0$146$e4fe514c@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
>>>
>>
>>
>
>
Author
2 Apr 2005 9:18 AM
Cor Ligthert
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
Author
2 Apr 2005 9:24 AM
Stephany Young
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.


Show quote
"Frank" <fr***@frank.com> wrote in message
news:424e6140$0$138$e4fe514c@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:424e5a5f$0$150$e4fe514c@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:eo4eap1NFHA.244@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:424e4a33$0$146$e4fe514c@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
>>>>
>>>
>>>
>>
>>
>
>
Author
2 Apr 2005 5:32 PM
Frank
Great idea!!!!
Thanks again
Frank

Show quote
"Stephany Young" <noone@localhost> schreef in bericht
news:um47DX2NFHA.2804@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:424e6140$0$138$e4fe514c@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:424e5a5f$0$150$e4fe514c@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:eo4eap1NFHA.244@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:424e4a33$0$146$e4fe514c@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
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Author
3 Apr 2005 3:18 PM
Frank
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
Show quote
"Stephany Young" <noone@localhost> schreef in bericht
news:um47DX2NFHA.2804@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:424e6140$0$138$e4fe514c@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:424e5a5f$0$150$e4fe514c@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:eo4eap1NFHA.244@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:424e4a33$0$146$e4fe514c@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
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Author
3 Apr 2005 4:52 PM
Stephany Young
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.

Show quote
"Frank" <fr***@frank.com> wrote in message
news:d2p1f8$r38$1@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:um47DX2NFHA.2804@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:424e6140$0$138$e4fe514c@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:424e5a5f$0$150$e4fe514c@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:eo4eap1NFHA.244@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:424e4a33$0$146$e4fe514c@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
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Author
4 Apr 2005 1:18 PM
Frank
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
Show quote
"Stephany Young" <noone@localhost> schreef in bericht
news:O8LpE2GOFHA.580@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:d2p1f8$r38$1@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:um47DX2NFHA.2804@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:424e6140$0$138$e4fe514c@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:424e5a5f$0$150$e4fe514c@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:eo4eap1NFHA.244@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:424e4a33$0$146$e4fe514c@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
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>

AddThis Social Bookmark Button