Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

need help with a query

LEGEND ,
Aug 02, 2006 Aug 02, 2006
I'm building a search page in ASP which will look at a specific table in
an Access database. The users can search with different criteria.

The table has a date field, which will contain people's date of birth.

In the search box I'd like the user to be able to search for anyone that
was born in 1930 for example. They'll just type a year into the form field.

However on my results page I'm getting the error message "Application
uses a value of the wrong type for the current operation." The line it
refers to is

rsResults_cmd.Parameters.Append rsResults_cmd.CreateParameter("param4",
135, 1, -1, rsResults__ParamYear) ' adDBTimeStamp

the sql for the query is:

SELECT *
FROM tblCerts
WHERE Type LIKE ParamType AND Surname LIKE %ParamSurname% AND FirstNames
LIKE %ParamFirstNames% AND ((Year([EventDate])) LIKE ParamYear)

I can put in a default year and click the test button in the recordset
dialog box and the correct records are returned. But on the page itself
I get the error message.

Please could someone tell me where I've gone wrong.
Thanks

Vix
TOPICS
Server side applications
258
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 02, 2006 Aug 02, 2006
I presume it's because 1930 isn't a valid entry for the date type - so you might need two search fields and enter 1-1-1930 and 31-12-1930 to return anyone born in 1930?

I'm still pretty new to this so could be barking up the wrong tree.

Iain
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 02, 2006 Aug 02, 2006
LATEST
I posted this in the dreamweaver form for you also.
Try this in your sql statement,

SELECT *
FROM tblCerts
WHERE Type LIKE ParamType AND Surname LIKE %ParamSurname% AND FirstNames
LIKE %ParamFirstNames% AND ((Year([EventDate])) LIKE #ParamYear#)

Dave


"Vix" <user@example.net> wrote in message
news:eaq9fu$t0g$1@forums.macromedia.com...
> I'm building a search page in ASP which will look at a specific table in
> an Access database. The users can search with different criteria.
>
> The table has a date field, which will contain people's date of birth.
>
> In the search box I'd like the user to be able to search for anyone that
> was born in 1930 for example. They'll just type a year into the form
field.
>
> However on my results page I'm getting the error message "Application
> uses a value of the wrong type for the current operation." The line it
> refers to is
>
> rsResults_cmd.Parameters.Append rsResults_cmd.CreateParameter("param4",
> 135, 1, -1, rsResults__ParamYear) ' adDBTimeStamp
>
> the sql for the query is:
>
> SELECT *
> FROM tblCerts
> WHERE Type LIKE ParamType AND Surname LIKE %ParamSurname% AND FirstNames
> LIKE %ParamFirstNames% AND ((Year([EventDate])) LIKE ParamYear)
>
> I can put in a default year and click the test button in the recordset
> dialog box and the correct records are returned. But on the page itself
> I get the error message.
>
> Please could someone tell me where I've gone wrong.
> Thanks
>
> Vix


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines