navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
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

Free FrontPage Templates

Search Forums
 

Advanced search
Recent Posts

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

 

A unique SQL problem???

 
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 >> A unique SQL problem???
Page: [1]
 
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
A unique SQL problem??? - 8/17/2002 11:04:31   
Has anyone ever experienced this problem:

I have a database of parts, when I perform searches for parts my SQL query only works in " SOME" situations. For example, one of the parts is a:

Compact Disk Case

When I search by: " Compact" , nothing is returned.
When I search by: " Disk" , nothing is returned.
When I search by: " Case" , the record shows up.

I am perplexed...... Here is my SQL statement:

SELECT * FROM PartsDatabase WHERE (Product Like ' %::Keyword::%' )

I' m using FP 2000, Access 2000 and the DRW. This is the first time I have run across this problem. Has anybody seen this problem before or have any ideas how to solve it???
Thanks in advance.
LLL
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: A unique SQL problem??? - 8/17/2002 14:25:04   
I ran into something similar with a search for product colors by name...

If you wanted to find a color called Manhattan Bridge Blue and you did a search for Blue it worked... but pulled up a thousand other Blue' s along with it...

if you did a search for Manhattan it worked, but pulled up everything with Manhattan...

If you did a search for Manhattan Blue it wouldn' t show up !?!?

I figured it was because the %' s were on the outside of the keyword, so it would only pull up records that included the entire keyword somewhere in the middle or on either side...

So Manhattan Blue wouldn' t find anything because there are no colors that have the phrase Manhattan Blue in them with nothing in between...

These would work:
Manhattan
Manhattan Bridge
Bridge Blue
Blue

I just learned to live with it and created a " search tips" page to explain how the query worked...

In your case it seems to be different, because I would think that
Compact
Compact Disk
Disk
Disk Case
Case

would all work, while Compact Case would not...

???

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to Long Island Lune)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: A unique SQL problem??? - 8/18/2002 1:59:06   
Bobby,

Thanks for your info. I' ll tell ya, I think this is a MS SQL weakness. And the thing is - it makes ME look sloppy. It makes me think I should jump to Oracle. Easier said than done. Your problem is defintely similar to what I am expericeing. There is no reason why the original SQL query I created shouldn' t work. I thought that maybe there was a trick that I didn' t know. I did a Google on SQL and visited 20 sites today. Nobody had anything to say about this problem. Not even Microsoft. Like you said, you learned to live with it. That was probably a smart, stressless descision to make. I' m still going to search for an answer to this crazy problem. It' s a real weakness that you would think Microsoft would have tackled by now!!! If I find the answer, I' ll post it to this posting for you. So blank-respond and click on " Notify me via-email when someone replies" if you want to know.
Thanks
LLL

(in reply to Long Island Lune)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: A unique SQL problem??? - 8/18/2002 23:40:42   
I don' t know.... Today it is working.... I don' t understand what is going on but now I can search by Disk, Compact or Case and the record appears. I do not know what happened. But it works!!! Hmmmmmmmmmm...
LLL

(in reply to Long Island Lune)
Vince from Spain

 

Posts: 658
From: Madrid Spain
Status: offline

 
RE: A unique SQL problem??? - 8/19/2002 13:34:36   
Hi Bobby,
I did a little search routine a short while ago that would take account of multiple words where you wanted ALL of them to appear, but not necessarily in the order given. The whole thing is quite long, but I' ll see if I can chop it into some kind of pseudocode that will give the idea.
<%
sText = request.form(" searchphrase" )
aText = Split(sText) ' so split searchphrase into an array on the spaces
sSQL = " SELECT * FROM myTable WHERE "
for rowcounter=0 to UBOUND(aText)
sSQL=sSQL & " myField LIKE ' %" &aText(rowcounter)&" %' "
if rowcounter<UBOUND(aText) then sSQL=sSQL & " AND "
next
' Now go submit the query
%>

This isn' t meant to be runable code, but hopefully it will give the idea.

LLL, sounds like gremlins, but normally I would say that the search you are making should work under MS SQL. It sounds like the second % was being missed off, as that would be expected behaviour if your search was . . .
SELECT * FROM PartsDatabase WHERE (Product Like ' %::Keyword::' )

Vince



< Message edited by Vince from Spain -- 8/18/2002 1:37:49 PM >

(in reply to Long Island Lune)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: A unique SQL problem??? - 8/19/2002 16:02:00   
Vince,

Good code. This algroithm worked for you??? On the page that I was working on, the DRW did most of the work. I always curse when I use the DRW for anything that is not simple. At first I thought it was simple. Silly me. Your remedy demonstrated hand-coding in .asp.

This is what I think happened:

Did you ever notice how when you save a page in FP, inside a large site that sometimes things get changed??? I' ve seen fonts change, colors change, things dissapear, code inside the webbot area get erased??? :)

What I did:
I wiped OUT the entire display page and rebuilt it. There must have been something not kosher in the page itself. I have done this 1 million times in my career so I don' t think it was me. The original page I played with. I' m admitting it. When I saved it, something was saved incorrectly. So when I rebuilt the page from scratch, I used the exact SQL Query that I mentioned in the very beginning of this post. Once it was done, I tested it in PWS. It worked great. I uploaded it to my server and it worked great. So when something all of a sudden starts working for no apparent reason, I have to think FP and it' s " save" routine had someting to do with it. That' s only an educated guess. :)
LLL

(in reply to Long Island Lune)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> A unique SQL problem???
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