473,657 Members | 2,624 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(aSearchC riteria)

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(aSearchC riteria)

SQL2 = SQL2 & "WebsiteMetaKey words LIKE '" & aSearchCriteria (intLoop) &
" %' OR "
SQL2 = SQL2 & "WebsiteMetaKey words LIKE '% " & aSearchCriteria (intLoop)
& " %' OR "
SQL2 = SQL2 & "WebsiteMetaKey words 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 1205
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
2906
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 expected project duration. This gives the client a fair fee for service, but protects both sides from a screw-up, while "punishing" the contractor (me) for screwing up the bid. You still have to manage the project's scope and snuff the usual...
11
1915
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 = CiDict() >> d 12
1
3095
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 report at run-time, using a .ttx file and using a DataSet as the source. My problem is that I want to dynamically change an image (user's pic) on the report based on the user parameter.
33
2696
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 it, neither love nor hate. Thanks, Larry.
29
2252
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 C++? What am I doing wrong? Here is my code: using System;
1
1283
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 2000 public folder where I have contacts stored and pull information from certain fields that the contacts have. I have read that I might be able to do this by installing the .NET framework on the exchange server and creating a web service on...
10
27849
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? Tim
1
1434
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 files of the network while I had my front end performing some tasks overnight and I have managed to copy an old version of the front end over the version i had open. I didn't know I
8
1904
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
8427
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8330
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8850
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, 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...
0
8746
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 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...
1
8523
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,...
0
5649
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();...
0
4175
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...
1
2749
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.