Forum Moderators: open

Message Too Old, No Replies

Need a simple select statement in ASP for db

         

kevinj

12:57 am on Sep 9, 2003 (gmt 0)

10+ Year Member



I can't get a select statement for an Access db to work properly

Set RS = DB.Execute("SELECT * FROM registrants WHERE (share_info <>'No') ORDER BY last_name ASC")

I need to only select the records where the value of share_info is not "No".

Thanks.

defanjos

1:43 am on Sep 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Wouldn't the following work?

Set RS = DB.Execute("SELECT * FROM registrants WHERE (share_info <>'"& No &"') ORDER BY last_name ASC")

kevinj

1:57 am on Sep 9, 2003 (gmt 0)

10+ Year Member



That I would say should work fine. There's something very strange about this. That statement only selects the records where share_info = "No". Just the opposite of what we would expect. I have no idea why.

mattglet

12:56 pm on Sep 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



defanjos' isn't going to work unless No is a variable.

or is No supposed to be a variable?

try simpling things out and do this:

SELECT * FROM registrants WHERE share_info <> 'No' ORDER BY last_name ASC

parens aren't always needed, especially when you're only comparing one condition.

-Matt

Zaphod Beeblebrox

11:45 am on Sep 12, 2003 (gmt 0)

10+ Year Member



Another possibility is that share_info is a field of type 'yes/no'. In that case, it's a boolean, and you should test for share_info=False...