What environment are you in?

I just did this in Access/VB and it gave the right results. However in VB,
'AND' is the bitwise op, not &.

So maybe you had it right the first time, except that you should have been
comparing to a number instead of a bool.

Is bit defined as a byte? Integer would probably also work; but if stored as
anything else, the bits in bit wouldn't line up right.


J.R.


-----Original Message-----
From: Diane Schips [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 02, 2002 11:17 AM
To: [EMAIL PROTECTED]
Subject: [wdvltalk] RE: SQL search using bitwise operation?


My current statement is:

strSQL = "SELECT * FROM test WHERE (bit & 2) = 2"

I have 50 records with bit equaling 1 - 50.  Yet the above statement now
returns an empty recordset.  Maybe my parens are off?

Diane



-----Original Message-----
From: J.R. Pitts [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 02, 2002 10:55 AM
To: [EMAIL PROTECTED]
Subject: [wdvltalk] RE: SQL search using bitwise operation?


Let me add to my previous answer.

You need to use the bitwise and (&)

ALSO, you compare to an integer value, not bool. So (bit & 2) would return
2.

J.R.

-----Original Message-----
From: Diane Schips [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 02, 2002 10:28 AM
To: [EMAIL PROTECTED]
Subject: [wdvltalk] SQL search using bitwise operation?


I want to search through a table returning all records where, say, bit 2 is
set.  How to I do this?  Say I'm concerned with a field called bit.  I've
tried the following:

strSQL = "SELECT * FROM test WHERE (bit AND 2) = true"

This doesn't work.  What am I doing wrong?

Diane


____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED]
       Send Your Posts To: [EMAIL PROTECTED]
To change subscription settings to the wdvltalk digest version:
    http://wdvl.internet.com/WDVL/Forum/#sub

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to %%email.unsub%%


____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED]
       Send Your Posts To: [EMAIL PROTECTED]
To change subscription settings to the wdvltalk digest version:
    http://wdvl.internet.com/WDVL/Forum/#sub

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to %%email.unsub%%


____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED]
       Send Your Posts To: [EMAIL PROTECTED]
To change subscription settings to the wdvltalk digest version:
    http://wdvl.internet.com/WDVL/Forum/#sub

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to %%email.unsub%%


____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] 
       Send Your Posts To: [EMAIL PROTECTED]
To change subscription settings to the wdvltalk digest version:
    http://wdvl.internet.com/WDVL/Forum/#sub

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to