Forums

This topic is locked

Define WHERE MMColParam

Posted 24 Jul 2007 13:17:49
1
has voted
24 Jul 2007 13:17:49 Ryan Preece posted:
Hi, I'm posting this here as I thought maybe I made a mistake putting it in the ASP section of the forum.

My original post is here: www.dmxzone.com/forum/topic.asp?topic_id=39133

original post below...

Hi All, it's been a while but I'm back with another one of those basic questions that I'm sure all you experts can answer in a heartbeat.

Basically, I have a small community site for a school where kids get to fill in they're hobbies, interests, favorite film, favorite book etc... all these are stored in the users profile as MEMO's. Each profile has a small paragraph of text stored i.e. fav_film, fav, books, hobbies and so on.

I'll use an example of what I want to achieve. Harry Potter is a big topic on there at the moment and exists across multiple fields. Some users have 'Harry Potter' mentioned in books and others have mentioned it in movies or likes fields.

I want to create a search page where a user can type in a bit of text ("Harry Potter in this example" and then specify which field they wish to search i.e. search in books (option in drop down list). The values in the list are relative to the field names so when I come to write the SQL on the recordset results page it looks a bit like this...

.......................................................................................................

SELECT *
FROM search_results
WHERE SVALUE LIKE %MMColParam%

The parameter / variable SVALUE = Text | Request.QueryString("s_interests" | default value = 1

s_interests is the name of the value passed from the drop down list from the search page obviously

The second parameter / variable is MMColParam = Text | Request.QueryString("s_search" | default value = 1

s_search is the input type box used on the search page.

............................................................................................

Am I doing something wrong? I've done a filter before in terms of order by ASC / DESC which worked and this seemed the next logical step but it doesn't work. The search works fine when I specify where to search by replacing SVALUE for fav_movie etc, but not when I try it through a drop down list?

So... in a nutshell my question is:

Can I use a drop down list as a means of filtering which field I want to search in a recordset?

Any help would be much appreciated and thank's for reading...

Update ----------------------------------

Hey, I think I'm getting somewhere here...

I changed the SVALUE to a boolean instead of text and it worked when I test it in dreamweaver.

However, when I upload the page I get this error:

ADODB.Command error '800a0d5d'

Application uses a value of the wrong type for the current operation.

/results.asp, line 26

When I change it back the error goes but so does the desired functionality! any ideas? do I need to format the SVALUE variable in some way?

Reply to this topic