The information is not writing to muy array in ASP

I

Imogen

HI there,
I really hope you can help as this is driving me mad!

I am trying to set up a calender on my site for events and found a
neat looking script. All works except the events aren't being writting
to the array. The code section i think is important is below

***********
sql = "SELECT id, startDate, endDate, name FROM calendarEvent " & _
"WHERE ((startDate >= #" & searchStart & "# AND endDate <= #" &
searchEnd & "#) " & _
"OR (startDate < #" & searchStart & "# AND endDate >= #" &
searchStart & "# AND endDate <= #" & searchEnd & "#) " & _
"OR (startDate <= #" & searchEnd & "# AND startDate >= #" &
searchStart & "# AND endDate > #" & searchEnd & "#) " & _
"OR (startDate < #" & searchStart & "# AND endDate > #" & searchEnd
& "#)) "
if trim(eventType) = "" then
'ignore it
elseif cint(eventType) = 1 then
sql = sql & "AND eventType = 1"
elseif cint(eventType) = 2 then
sql = sql & "AND eventType = 2"
elseif cint(eventType) = 3 then
sql = sql & "AND eventType = 3"
elseif cint(eventType) = 4 then
sql = sql & "AND eventType = 4"
else
'ignore it
end if
Set rs_getEvent = cn_Connection.Execute(sql)
%><%response.write("sql = " & sql & "<br>")%><%
sql = ""
sql = "SELECT id, eventType FROM eventType"
Set rs_getType = cn_Connection.Execute(sql)

curDate = searchStart
for x = 1 to day(searchEnd)
redim preserve eventID(x)
redim preserve eventName(x)

if not rs_getEvent.BOF then rs_getEvent.movefirst
while not rs_getEvent.EOF
x1 = rs_getEvent("startDate")
x2 = rs_getEvent("endDate")
if x1 = curDate OR x2 = curDate OR (x1 < curDate AND x2 > curDate)
then
'make a list for event for each day
eventID(x) = eventID(x) & rs_getEvent("id") & "~||~"
eventName(x) = eventName(x) & rs_getEvent("name") & "~||~"
end if
rs_getEvent.movenext
wend
%><%response.write("<b>eventName("&x&") =
"&eventName(x)&"</b><br><br>")%><%'eventName(x)
'move current day to next day
curDate = dateAdd("d", 1, curDate)
next

'check if date is in this month
if dateFormat = 1 then
if Not month(DateAdd("d", curDay-1, curMonth & "/1/" & curYear)) =
cint(curMonth) then curDay = 1
lastDay = day(dateserial(curYear, curMonth+1, 1-1))
today = curMonth & "/" & curDay & "/" & curYear
else

if Not month(DateAdd("d", curDay-1, "1/" & curMonth & "/" &
curYear)) = cint(curMonth) then curDay = 1
lastDay = day(dateserial(curYear, curMonth+1, 1-1))
today = curDay & "/" & curMonth & "/" & curYear
end if
%>

********

Can anyone see anything why this would be happning - if you need more
information then i can email you all the code... it runs of a two
table database.

I really hope you can help..

Vicky
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,085
Members
48,773
Latest member
Kaybee

Latest Threads

Top