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