473,322 Members | 1,510 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,322 software developers and data experts.

Anyone got any ideas?

Hi all,

This will sound REALLY stupid, but I wrote some code a fair while ago
(beginning of this year), and I've done something a specific way, but for
the life of me I can't remember why, or whether the difference between the 2
ways that are used in the code really matters...

I think Aaron had some suggestions at the time...

Anyway...here we go...

I've got several columns in a database table, when I'm handling search
criteria from a form, I have something like this:

For intLoop = 0 To UBound(aSearchCriteria)

SQL2 = SQL2 & "' ' + WebsiteName + ' ' LIKE '% " &
aSearchCriteria(intLoop) & " %' AND "

Next

Note: This is a quick snip from a big page...

As you can see, I'm adding the ' ' at the beginning and end of the field,
and then doing the same with the search criteria, I guess this was to find
'words' (a word being defined in this scenario with a space either side -
ignoring punctuation etc for now).

I seem to have done it like this for most of the 'name' columns, even some
description ones, but anything that was deemed as 'content' has been done
like this:

For intLoop = 0 To UBound(aSearchCriteria)

SQL2 = SQL2 & "WebsiteMetaKeywords LIKE '" & aSearchCriteria(intLoop) &
" %' OR "
SQL2 = SQL2 & "WebsiteMetaKeywords LIKE '% " & aSearchCriteria(intLoop)
& " %' OR "
SQL2 = SQL2 & "WebsiteMetaKeywords LIKE '% " & aSearchCriteria(intLoop)
& "' OR "

Next
As you can see, this time I have 3 parts, a start of field, a middle of
field and an end of field...the ends (beginning and end) have the % wildcard
missing where appropriate (ie, there wouldn't be any content after this to
worry about anyway)...the middle one is similar to the first method above
for finding 'words'..

Now, I'm in the process of adding some code to support words that having
punctuation added to them in my database, but when a user searches, they
dont enter it...

For example:

keywords - "umbrella company, pensions, insurance, phi, ir35"

So, if this was the content of one of my columns in the table, a user is
unlikely to be entering comma's when they search, more likely they might
just enter "pensions", therefore in my new code I have a small array of the
most likely punctuation;

Dim aPunctuation(9)

aPunctuation(0) = "" ' added for no punctuation
aPunctuation(1) = "."
aPunctuation(2) = ","
aPunctuation(3) = ";"
aPunctuation(4) = ":"
aPunctuation(5) = "!"
aPunctuation(6) = "?"
aPunctuation(7) = ")"
aPunctuation(8) = """"

The first item was added as a quick way of having just the normal option,
ie, without any punctuation when a search is performed..

This would now test against my column for, as an example;

pensions
pensions.
pensions,
pensions;
.....and so on...perfect...

What I cant work out though, and being really tired right now isn't helping,
is whether it makes any difference having the ' ' + column_name + ' ', or
the other way with the beginning, middle, end....

Can anyone think of a reason why this would make a difference...it might
well have been at the time that the 3 parts way was better and I only added
it to the columns I thought necessary at the time (being lazy), but I truly
cant remember...

I know I'm asking a lot here, practically asking you guys to remember for me
:oD But if anyone can see from the code above why I might have gone this
way I'd be eager to hear from you :o)

Thanks in advance for any help.

Regards

Rob
Jul 22 '05 #1
1 1188
Jesus, it just took me about 15 minutes to type all that, then I amazing
stumbled across a previous post I made here where I answered my own
question - LOL!

I had the 2 ways of doing this because you cant seem to concatenate ' ' to a
column that has a TEXT data type! Hence the other method for those
columns....

*sigh*

Thanks anyway.... :o)

Rob
Jul 22 '05 #2

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

Similar topics

4
by: Raptor | last post by:
I know it's bordeline off topic, but this is a subject which concerns many and is not frequently discussed. How about: bid the project at your usual rate, but bid a much lower rate beyond the...
11
by: Ville Vainio | last post by:
I need a dict (well, it would be optimal anyway) class that stores the keys as strings without coercing the case to upper or lower, but still provides fast lookup (i.e. uses hash table). >> d...
1
by: Ed | last post by:
I've search around endlessly for a solution to this problem but have not found anything yet. I'm using Crystal 9 with .NET. I am not using a DSR to create the report. Instead I am creating a...
33
by: Larry | last post by:
Does anyone use the 3rd party utility CodeRush for VStudio? If so then I would like to see how well it is loved or hated. I have been using the trial for a week and I have a mixed opinion about...
29
by: Roy Gourgi | last post by:
Hi, I am new to C#. I have the same time scheduling program written in C++ and it is 5 times faster than my version in C#. Why is it so slow as I thought that C# was only a little slower than...
1
by: Bill | last post by:
Has anyone used ASP.NET to access Exchange 2000 to populate dropdownboxes from a public folder contact? I am not sure if this is possible, but I am needing a web application to hit my exchange...
10
by: Tim Frawley | last post by:
I am attempting to detect a Shift+Tab in the KeyPress event for back navigation on a control that doesn't support this method. Does anyone have any ideas how to compare e.KeyChar to a ShiftTab? ...
1
by: dkintheuk | last post by:
Hi all, Just had the wierdest thing happen overnight to one of my databases. I have a frontend/backend set up with the front end under development on my machine. I was copying a load of old...
8
by: mahmoud wessimy | last post by:
hi can anyone tell me some ideas cauz i have a project in c++ to do any program i want but i don't know what to do?
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.