Is it possible to use a multi-parameter query in .NET
Here's the method
Public Function SearchCatalog(B yVal searchString As String, ByVal allWords As String) As OleDbDataReade
' Create the connection objec
Dim connection As New OleDbConnection (connectionStri ng
Dim command As New OleDbComman
' We guard agains bogus values here - if we receive anythin
' different than "TRUE" we assume it's "FALSE
If allWords.ToUppe r = "TRUE" The
' Create and initialize the command object and search all word
command.Command Text = "SearchCatalogA llWords
command.Connect ion = connectio
command.Command Type = CommandType.Sto redProcedur
Els
' Create and initialize the command object and search any word
command.Command Text = "SearchCatalogA nyWords
command.Connect ion = connectio
command.Command Type = CommandType.Sto redProcedur
End I
' We eliminate separation character
searchString = searchString.Re place(",", " "
searchString = searchString.Re place(";", " "
searchString = searchString.Re place(".", " "
' We create an array which contains the word
Dim words() As String = Split(searchStr ing, " "
' wordsCount contains the total number of word
Dim wordsCount As Integer = words.Lengt
' index is used to parse the list of word
Dim index As Integer =
' this will store the total number of added words
Dim addedWords As Integer =
' We allow a maximum of 5 word
While addedWords < 5 And index <
' We add the @searchWord parameters her
If addedWords < wordsCount The
addedWords +=
' Add an input parameter and supply a value for i
command.Paramet ers.Add("@searc hWord" + addedWords.ToSt ring, words(index)
Els
addedWords +=
' Add a blank input paramete
command.Paramet ers.Add("@searc hWord" + addedWords.ToSt ring, ""
End I
index +=
End Whil
' Open the connectio
connection.Open (
' Return a SqlDataReader to the calling functio
Return command.Execute Reader(CommandB ehavior.CloseCo nnection
End Functio
Here is the query
SELECT Product.Product ID, Product.Name, Product.Descrip tion, Product.SKU, Product.Price, Product.ImagePa t
FROM Produc
WHERE (((Product.Name ) Like "*"+[@searchWord1]+"*")) OR (((Product.Desc ription) Like "*"+[@searchWord1]+"*"))AND (((Product.Name ) Like "*"+[@searchWord2]+"*")) OR (((Product.Desc ription) Like "*"+[@searchWord2]+"*")) AND (((Product.Name ) Like "*"+[@searchWord3]+"*")) OR (((Product.Desc ription) Like "*"+[@searchWord3]+"*")) AND (((Product.Name ) Like "*"+[@searchWord4]+"*")) OR (((Product.Desc ription) Like "*"+[@searchWord4]+"*")) AND (((Product.Name ) Like "*"+[@searchWord5]+"*")) OR (((Product.Desc ription) Like "*"+[@searchWord5]+"*")) 0 1738 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ajikoe |
last post by:
Hello,
Is anyone has experiance in running python code to run multi thread
parallel in multi processor. Is it possible ?
Can python manage which cpu shoud do every thread?
Sincerely Yours,
Pujo
|
by: Frank Jona |
last post by:
Intellisense with C# and a multi-file assembly is not
working. With VB.NET it is working.
Is there a fix availible?
We're using VisualStudio 2003
Regards
Frank
|
by: * ProteanThread * |
last post by:
but depends upon the clique:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=954drf%24oca%241%40agate.berkeley.edu&rnum=2&prev=/groups%3Fq%3D%2522cross%2Bposting%2Bversus%2Bmulti%2Bposting%2522%26ie%3DUTF-8%26oe%3DUTF-8%26hl%3Den
...
|
by: frankenberry |
last post by:
I have multi-page tiff files. I need to extract individual frames from the
multi-page tiffs and save them as single-page tiffs. 95% of the time I
receive multi-page tiffs containing 1 or more black and white CCITT4
compressed files (frames) inside the tiff. Every now and then I receive a
mixture of black and white CCITT4 and JPEG compressed files, and sometimes
just multi-page tiffs with JPEG only. The code runs great when dealing with
the...
|
by: cody |
last post by:
What are multi file assemblies good for?
What are the advantages of using multiple assemblies (A.DLL+B.DLL) vs. a
single multi file assembly (A.DLL+A.NETMODULE)?
| |
by: mimmo |
last post by:
Hi! I should convert the accented letters of a string in the correspondent
letters not accented. But when I compile with -Wall it give me:
warning: multi-character character constant
Do the problem is the charset? How I can avoid this warning? But the worst
thing isn't the warning, but that the program doesn't work! The program
execute all other operations well, but it don't print the converted
letters: for example, in the string...
|
by: =?Utf-8?B?R2Vvcmdl?= |
last post by:
Hello everyone,
Wide character and multi-byte character are two popular encoding schemes on
Windows. And wide character is using unicode encoding scheme. But each time I
feel confused when talking with another team -- codepage -- at the same time.
I am more confused when I saw sometimes we need codepage parameter for wide
character conversion, and sometimes we do not need for conversion. Here are
two examples,
|
by: Sabri.Pllana |
last post by:
We apologize if you receive multiple copies of this call for papers.
***********************************************************************
2008 International Workshop on Multi-Core Computing Systems
(MuCoCoS'08)
Barcelona, Spain, March 4 - 7, 2008; in conjunction with CISIS'08.
<http://www.par.univie.ac.at/~pllana/mucocos08>
***********************************************************************
Context
|
by: mknoll217 |
last post by:
I am recieving this error from my code:
The multi-part identifier "PAR.UniqueID" could not be bound.
The multi-part identifier "Salary.UniqueID" could not be bound.
The multi-part identifier "PAR.UniqueID" could not be bound.
The multi-part identifier "PAR.PAR_Status" could not be bound.
The multi-part identifier "Salary.New_Salary" could not be bound.
The multi-part identifier "Salary.UniqueID" could not be bound.
The multi-part...
|
by: Aussie Rules |
last post by:
Hi,
I have a site that Iwant to either display my text in english or french,
based on the users prefernces ?
I am new to webforms, but I know in winforms, this is pretty easy with a
resource file.
What is the best way to acheive this with webforms ?
|
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,...
| |
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: 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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: 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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
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...
| |