Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-05-09 : 10:33:27
|
Eric writes "Hello Team,I need to be able to search a table (MS Access on Win 2000 Pro) that resides on PWS and IIS Server (yeah, kind a upside down :) ). This search is however a multiple keyword type. The string can be either comma or space delimited; probably space delim. would work better. I am using ASP 3.0 as my scripting language.So far I am able to search the table with single word (who doesn't) with a dynamic query. I found some articles on your web site that sort of "hit home" except that the examples are for SQL Server. I did like the example titled "eyword search using a tally or sequence table on 10/8/2001 rated 5.0 (4)" except that some functions do not appear to ASP/VBscript functions.What I was trying to implement the following.I would pass a querystring and using a split function to break in down. But then it became challenging, how to match elements of the split array with individual record set? I'm thinking using a nested while loop to parse through the records, but where or how would I save the fetched data before sneding it to the browser." |
|
SMerrill
Posting Yak Master
206 Posts |
Posted - 2002-05-21 : 16:09:12
|
Using a split function is the right idea. Let's say it is "Acro*, B*, *test*". Write a function like this:fSearchKeywords(ByVal strKeywords as String, ByVal rstToSearch as Recordset) as Recordset First, it should split the input string on commas (or spaces if commas do not exist) and generate a dynamic WHERE clause, which will result in'Field LIKE "Acro*" OR Field LIKE "B*" OR Field LIKE "*test*"' Then, set the Filter property of the input recordset to this string you just made, and set the FilterOn property to True.Slam-bam, the resulting recordset is filtered. Pass it back to the calling routine with the command Set fSearchKeywords = rst Finally, your calling routine could set the recordset property of the web control to the result of this function.--SMerrillSeattle, WA |
 |
|
|
|
|
|
|