|
| Searching a database with multiple parameters |
 |
Thu, 3 Apr 2008 01:15:02 +0000 |
I have tried to search the forum but have come backed with mixed results. I want
to be able to allow someone to search for a string in a database and have the
results returned by my stored procedure. So for example, if I want to search by
product, I select product from the pulldown menu and enter "Visual
Studio" and hit search. Now, how would I split Visual and Studio into two
separate parameters and pass them into my stored procedure so you can search the
database (using a WHERE LIKE..?) clause? Any recommendations?
|
| Post Reply
|
| Re: Searching a database with multiple parameters |
 |
Thu, 3 Apr 2008 01:41:42 +0000 |
If you're using SQL server have you considered using full-text indexing? Stick
it in Google, it takes a bit of reading up but is pretty versatile and would
probably meet your requirements.
|
| Post Reply
|
| Re: Searching a database with multiple parameters |
 |
Mon, 7 Apr 2008 08:02:40 +0000 |
Hi lokus,
Based on your description, you can do it by following steps.
First, in the button click handler, you can get the value in pulldown control.
Then, you can format the value like "Visual,Studio".
Finally, you can research the records with multiple key words. You need to write
your store procedure like this:
Create procedure SrcMulKeyWords
( Conditions varchar(200) )
as
// You can use SUBSTRING and CharIndex method to split the Conditions via
character ','
// Then write your select query like this: select * from Tab where conditions
like condition1 OR conditions like condition2 OR conditions like condition3
This is just a simple sample to demonstrate the steps, you need to modify it to
suit your requirements. If there's still any questions, please feel free to let
me know. Hope this helps you!
Thanks.
|
| Post Reply
|
|
|
|
|
|
|
|
|
|