Howdy,
I am doing a simple keyword search in my SQL database from my ASP.NET w/ VB
application. Currently, I am using a PROC and within the PROC I am doing
something like so:
SELECT * FROM tblStores WHERE strName LIKE '%' + @Search + '%' AND strCity
LIKE '%' + @Search + '%' and so on
This works GREAT for a single keyword like marshalls. However, if the user
enters in 'marshalls ma' nothing returns and I understand why.
How do I split this string in the PROC and then use each piece to search
against? Is there a better way than I am thinking?
Thank you!!
David Lozzi 2 1568
David Lozzi wrote: Howdy,
I am doing a simple keyword search in my SQL database from my ASP.NET w/ VB application. Currently, I am using a PROC and within the PROC I am doing something like so:
SELECT * FROM tblStores WHERE strName LIKE '%' + @Search + '%' AND strCity LIKE '%' + @Search + '%' and so on
This works GREAT for a single keyword like marshalls. However, if the user enters in 'marshalls ma' nothing returns and I understand why.
How do I split this string in the PROC and then use each piece to search against? Is there a better way than I am thinking?
Thank you!!
David Lozzi
Your code must separate the words into a CSV string.
Easy example:
mySearchString = mySearchString. Replace(" ","%,%")
then:
SELECT *
FROM tblStores
WHERE strName IN@Search
UNION
SELECT *
FROM tblStores
WHERE strCity IN @Search
That way you can get results if the search is in one clumn and not the
other.
/RT
This kind of works. For example:
SELECT * FROM tblStores WHERE strState IN ('ma','nh')
works, but if I do this
SELECT * FROM tblStores WHERE strState IN ('%m%','%n%')
Nothing returns. It doesn't appear to suppose wild cards?
--
David Lozzi
Web Applications Developer dlozzi@(remove-this)delphi-ts.com
"Ryan Ternier" <rt******@icomp asstech.com> wrote in message
news:OF******** ******@TK2MSFTN GP10.phx.gbl... David Lozzi wrote: Howdy,
I am doing a simple keyword search in my SQL database from my ASP.NET w/ VB application. Currently, I am using a PROC and within the PROC I am doing something like so:
SELECT * FROM tblStores WHERE strName LIKE '%' + @Search + '%' AND strCity LIKE '%' + @Search + '%' and so on
This works GREAT for a single keyword like marshalls. However, if the user enters in 'marshalls ma' nothing returns and I understand why.
How do I split this string in the PROC and then use each piece to search against? Is there a better way than I am thinking?
Thank you!!
David Lozzi
Your code must separate the words into a CSV string.
Easy example:
mySearchString = mySearchString. Replace(" ","%,%")
then:
SELECT * FROM tblStores WHERE strName IN@Search UNION SELECT * FROM tblStores WHERE strCity IN @Search
That way you can get results if the search is in one clumn and not the other.
/RT This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: huzz |
last post by:
I've a table filed holds keywords seperated by comma, and a web search form
where a user can type one of multiple keywords in the search text field
seperated by comma aswell. How do i create a sql statement to bring results
that matches one or more keywords in the database?
Many thanks in advance..
huzz
|
by: D. Dante Lorenso |
last post by:
Trying to use the 'search' in the docs section of PostgreSQL.org
is extremely SLOW. Considering this is a website for a database
and databases are supposed to be good for indexing content, I'd
expect a much faster performance.
I submitted my search over two minutes ago. I just finished this
email to the list. The results have still not come back. I only
searched for:
SECURITY INVOKER
|
by: tshad |
last post by:
Can you do a search for more that one string in another string?
Something like:
someString.IndexOf("something1","something2","something3",0)
or would you have to do something like:
if ((someString.IndexOf("something1",0) >= 0) ||
((someString.IndexOf("something2",0) >= 0) ||
|
by: JP SIngh |
last post by:
Hi All
This is a complicated one, not for the faint hearted :) :) :)
Please help if you can how to achieve this search.
We have a freetext search entry box to allow users to search the database. I
am searching two tables.
SELECT TapeRecords.Id, TapeRecords.ItemTitle, TapeRecords.SourceRef,
|
by: Richard S |
last post by:
CODE: ASP.NET with C#
DATABASE: ACCES
alright, im having a problem, probably a small thing, but i cant figure out, nor find it in any other post, or on the internet realy (probably cuz i wouldnt know what to search for), but heres the problem:
I am making a search function for my website, i want this to be possible:
- search for 1 keyword (the problem guy)
- search for multiple keywords
things that alreaddy work (so no problem with...
| |
by: mforema |
last post by:
Hi Everyone,
I want to search records by typing in multiple keywords. I currently have a search form. It has a combo box, text box, Search command button, and a subform. The combo box lists the names of the fields found in my subform. The search form is supposed to allow a user to choose which field he/she wants to search by and then type a keyword(s) in the text box. The subform should display the filtered results.
My problem occurs...
|
by: rlemusic |
last post by:
Hi everybody,
I’m creating a database in Access (I believe it’s 2000) to catalogue items in the archives of a small museum. I’m a total n00b as far as using Access goes, but by looking at some online tutorials and how the museum’s existing collections catalogue is set up in Access, I’ve been able to come up with a basic database that suits the museum’s needs.
My biggest issues right now concern Relationships and Codes. I managed to get a...
|
by: Bob Alston |
last post by:
I am doing volunteer work with a human services referral agency. The
want me to build a database of referral data - other agencies, sources
of information, etc. Ideally it would be a structured search searching
different fields of the database, like cities served, predefined
keywords, etc.
Obviously I could build this. Using a Query by form type approach.
but I am also thinking about the database portion. If there is a field
in...
|
by: Skywick |
last post by:
Hi
I am trying to do a full text search with a column name for the search term.
I can do this using LIKE with:
SELECT tblContent.ID FROM tblContent INNER JOIN #keywords ON tblContent.words LIKE '%' + #keywords.keyword + '%'
But I can not seem to do this using the CONTAINS syntax.
eg.
|
by: luke noob |
last post by:
can some one please help me adapt my script so that i can search for multiple words within my database,
my keywords feild looks something like this....
Big Teddie Bear Collection Tiny Small Soft
At the moment if i search for the word "teddie" i will get "teddie" and if i search for "teddie bear" i will get "teddie bear", because in the keywords feild in the database "teddie" and "bear" are next to each other. but if i search for...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |