473,397 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Generate a SQL statement like a search engine

I'm looking for some code that would generate a SQL statement from a single
textbox in which a user could type in any number of words and quote-
enclosed phrases, just like Google or any other search engine. They won't
be using anything fancy like +, -, AND, OR, NEAR, etc. Just single words
and quote-enclosed phrases.

I'm sure some sample VB code like this exists somewhere, but I can't find
it. Could someone point me in the right direction?

Thanks,
Matt
Nov 21 '05 #1
1 1406
Well why do you write it?

doesn't seem too difficult.

If you don't want and or or's then you are obviously going to just do an AND
I guess.

so for simple words
'get words into array
dim Words() as string=textbox1.text.split(" ")
dim sbSQL as new StringBuilder

sbSQL.append("SELECT (whatever, I don't know what) FROM sometable where
keyword in("
for sh as short=0 to Words.count-1
sbSQL.append(Words(sh))
if sh<>Words.Count-1 then sbSQL.append(",")
next sh

sbSQL.append(")")

Something like this would work...I am not in the IDE so don't hold me to the
syntax--this is all from memory--but very easy to do. No for the quotes you
would need to write code to get the quotes words out first I suppose.

HTH,

Shane

"Matt" <no****@nospam.com> wrote in message
news:Xn************************@207.46.248.16...
I'm looking for some code that would generate a SQL statement from a single textbox in which a user could type in any number of words and quote-
enclosed phrases, just like Google or any other search engine. They won't
be using anything fancy like +, -, AND, OR, NEAR, etc. Just single words
and quote-enclosed phrases.

I'm sure some sample VB code like this exists somewhere, but I can't find
it. Could someone point me in the right direction?

Thanks,
Matt

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: R. Rajesh Jeba Anbiah | last post by:
Q: Is PHP search engine friendly? Q: Will search engine spiders crawl my PHP pages? A: Spiders should crawl anything provided they're accessible. Since, nowadays most of the websites are been...
11
by: Petre Huile | last post by:
I have designed a site for a client, but they have hired an internet marketing person to incrase their search engine ranking and traffic. He wants to put extra-large fonts on every page which will...
5
by: George | last post by:
Hi, Anyone has the background for explaining? I have made a search on my name and I have got a link to another search engine. The link's title was the search phrase for the other search engine...
2
by: Patrick | last post by:
Are the differences between a search engine, a subject directory and a meta search engine significant for an ebusiness web site owner? A meta search engine merely uses ordinary existing search...
3
by: Andy_Khosravi | last post by:
I have been trying to build a user friendly search engine for a small database I have created. I'm having some particular problems with one of my date fields. Here's the setup: I'm using...
5
by: Sam | last post by:
Does anyone know of a way to create a search page under ASP.NET 2.0? I have started out by configuring a catalog in Index Server, registering the aspx, ascx extensions in the registry to allow...
4
by: Joe | last post by:
How can I run a SQL statement from VB.NET I want to set a text box equal to something retrived from a select statemen ex textbox.text=SELECT CAR from AUTOS where AUTO_ID= '" &...
2
by: Adnan Al-Ghourabi | last post by:
Hi, We have a need to create pages on the fly for ASP.NET applications based on some string that the Url ends with. For example: http://www.domain.com/SomePath/aabbccdd. "aabbccdd" does not...
4
by: MDW | last post by:
Posted this on another board, but evidently it was off-topic there...hope you folks will be able to provide some guidance. I've been working on a Web site for a business (my first non-personal...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.