navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

is it ok to use and or in a clause

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> is it ok to use and or in a clause
Page: [1]
 
pintofale

 

Posts: 14
Joined: 9/10/2006
Status: offline

 
is it ok to use and or in a clause - 1/22/2008 14:26:36   
I am building a search form for an access db and have a statment which uses and/or statments in the clause. I am not sure if the syntax is correct or not. Any help or pointers would be great.

this is the statement:

Set rs = Conn.Execute("SELECT id, subject,  firstname FROM notes WHERE subject LIKE '%%& Request.form("lastname") &%%' OR firstname LIKE '%%& Request.form("firstname") &%%' OR subject LIKE '%%& Request.form("lastname") &%%' AND firstname LIKE  '%%& Request.form("firstname") &%%'")
rdouglass

 

Posts: 9186
From: Biddeford, ME USA
Status: offline

 
RE: is it ok to use and or in a clause - 1/23/2008 8:16:52   
quote:

Set rs = Conn.Execute("SELECT id, subject, firstname FROM notes WHERE subject LIKE '%%& Request.form("lastname") &%%' OR firstname LIKE '%%& Request.form("firstname") &%%' OR subject LIKE '%%& Request.form("lastname") &%%' AND firstname LIKE '%%& Request.form("firstname") &%%'")


How about this way:

Set rs = Conn.Execute("SELECT id, subject, firstname FROM notes WHERE ((subject LIKE '%" & Request.form("lastname") & "%') OR (firstname LIKE '%" & Request.form("firstname") & "%')) OR ((subject LIKE '%" & Request.form("lastname") &" %') AND (firstname LIKE '%" & Request.form("firstname") &" %'))")

Something like that?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to pintofale)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> is it ok to use and or in a clause
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts