|
|
 |
RE: RE: FN-FORUM: asp/access SQL help
date posted 1st December 2006 15:27
as is the norm with these things after I've asked for help.... I've just fixed it
changing this
thisMonth = split(Request.QueryString("date"), "/")
to this
thisMonth = split(Request.QueryString("date"), "/") (1)
along with using '%' as a wildcard and taking the (2) out of the query fixed it
Sorry Phil, should have sent a 'sorted it' email, thanks for the help all the same
>
>What format does 'date' take on the query string?
>
>And have you tried printing thisMonth(2) to see what it is?
>
>-----Original Message-----
>From: [EMAIL REMOVED] [EMAIL REMOVED] On Behalf Of
[EMAIL REMOVED]
>Sent: 01 December 2006 15:20
>To: FN-FORUM / [EMAIL REMOVED]
>Subject: FN-FORUM: asp/access SQL help
>
>
>Its friday and my brain obviously isnt working how it should...
>
>I have an ASP script which is supposed to query an access database for all
>records that have a date occuring in the current month or, if a date has
>been passed to the script, occuring in the requested month.
>
>The important bits I have are...
>
>--------------
>dim thisMonth
>
>if len(Request.QueryString("date")) > 0 then
> thisMonth = split(Request.QueryString("date"), "/")
> else
> thisMonth = Month(Date)
> end if
>--------------
>
>and then for the SQL query...
>
>--------------
>if len(Request.QueryString("date")) > 0 then
> cmdTemp.CommandText = "SELECT * FROM events WHERE eventDate LIKE '**/" &
>thisMonth(2) & "/**'"
>else
> cmdTemp.CommandText = "SELECT * FROM events WHERE eventDate LIKE '**/" &
>thisMonth & "/**'"
>end if
>--------------
>
>it works if you dont set a date (or it at least writes out the SQL query
>I've told it to) but as soon as you pass it a date you get 'Error Type:
>Response object, ASP 0106 (0x80020005)An unhandled data type was
>encountered.'
>
>is it to do with the Split statement or the SQL query? also, whats the
>correct SQL query if the eventDate is structured as 01/12/2006?
>
>cheers
>
>--
>Freelancers, contractors earn more with Prosperity4
>Call 0870 870 4414 or visit www.prosperity4.com
>and benefit from Inland Revenue approved expenses today.
>
>To advertise here: http://www.freelancers.net/advertising.html
>
>
>--
>Freelancers, contractors earn more with Prosperity4
>Call 0870 870 4414 or visit www.prosperity4.com
>and benefit from Inland Revenue approved expenses today.
>
>To advertise here: http://www.freelancers.net/advertising.html
>
> |
 |
|