|
|
 |
RE: FN-FORUM: asp/access SQL help
date posted 1st December 2006 14:56
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
|
 |
|