If you leave either Artist or Song blank the search degenerates to this:
Artist like '%%' OR Song like '%%'
Which will match ANYTHING. Because they are OR'ed together it can just ignore the
other clauses because that one will match everything.
At 03:16 PM 12/19/00 -0400, Ang�l Stewart wrote:
>Someone asked me this question, and my response apparently didn't help them.
>So I'm asking you gurus out there :)
>
>The person is using ASP.
>They want to search an .mp3 ACCESS database with a wildcard search on Artist
>and Song depending on what is entered.
>
>Their statement is as follows:
>
>(MP3.Genre = '::Genre::' OR MP3.Artist LIKE '%::Artist::%' OR MP3.Song LIKE
>'::Song::')"
>that works for artist searches
>
>(MP3.Genre = '::Genre::' OR MP3.Artist LIKE '::Artist::' OR MP3.Song LIKE
>'%::Song::%')"
>works for song searches
>
>but if I have this...
>(MP3.Genre = '::Genre::' OR MP3.Artist LIKE '%::Artist::%' OR MP3.Song LIKE
>'%::Song::%')"
>
>inputing data in either artist or song field..just returns the entire
>database
>
>I can't understand why taken seperately without the %..% wildcards, this
>would work.
>But when combined..it doesn't.
>
>Without testing it myself, I believe it is picking up null or space or
>whatever in the fields as being present in all the Song fields/ Artist
>fields and thus returning all records.
>
>What's the workaround for this??
>
>I'm thinking he is gonna have to use ASP code to check IF one of the fields
>is Null or something and build a more complex on the fly SQL statement.
>
>:-\
>
>-Gel
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists