Wrox Programmer Forums
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 14th, 2004, 04:26 AM
Authorized User
 
Join Date: Jul 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Search Engine

Hi,

I am currently doing a search engine for my project. The problem is if i have a record called "Hello World" in the database but when i search and type this "World Hello", no records will be found.

My sql statement is this "Select * from table where columnNA like % variable name %".
I would like to know is there any method that can solve my problem?

Snowydust
__________________
Snowydust
 
Old September 14th, 2004, 08:47 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there...

you need to add some * and ? to your matching string.. you will never find a "reversed" string that way.. world hello is not like hello world..
you can find your record using *world or hello* or he*ld.. that way you will find it.. but adding * all over your string will not do the trick...

HTH

Gonzalo
 
Old September 14th, 2004, 09:59 PM
Authorized User
 
Join Date: Jul 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

hmm, what i actually need is the sql statement, i don't think that sql statement support a * right? It seems that * is the same as % only that * works in dos. So can you give me a sample of the sql statement which may solve my problem?

Snowydust
 
Old September 15th, 2004, 12:25 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

yes it can.. try something like

Select * from table where columnNA like 'hellow*' and you will receive it...

HTH

Gonzalo
 
Old September 16th, 2004, 06:04 AM
Authorized User
 
Join Date: Jul 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,

The only method which i try successfully is using the contains. Select * from tbl where contains(columnNA, 'variable'). I am using ms sql right now therefore i think that it only accepts % not *.

Snowydust
 
Old September 16th, 2004, 09:00 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

% is the same for *.. you use % in standard SQL and * in access.. my fault! :)



HTH

Gonzalo
 
Old October 14th, 2004, 03:59 AM
Authorized User
 
Join Date: Oct 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jolzy
Default

'try this
'---------------------------------

"SELECT * FROM table WHERE columnNA LIKE'%" & Text1.Text & "%'"

happy coding

:)










Similar Threads
Thread Thread Starter Forum Replies Last Post
search engine raaj Beginning PHP 1 August 1st, 2007 06:52 AM
Search Engine for Full-text Search Kala ASP.NET 1.0 and 1.1 Professional 2 August 29th, 2004 02:16 AM
Search engine that search through local drive! wenzation Classic ASP Basics 0 August 26th, 2003 09:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.