does anyone have any idea why this script should be taking so long: (theres only 2 records in the database!!!)
Code:
<%
'here is the connection string
Set conn = server.createobject("adodb.connection")
'this connection uses JET 4 it is the prefered method of connecting to an access database
DSNtemp = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("events.mdb")
'if you cant use JET then comment out the line above and uncomment the line below
'DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("/slog/login.mdb")
conn.Open DSNtemp
SQL = "SELECT * FROM events"
Set RSgetall = conn.execute(SQL)
If RSgetall.EOF Then
response.write("We currently have no events upcoming.")
Else
While Not RSgetall.EOF
thisdate = RSgetall("edate")
if (cdate(thisdate)) < Now() Then
else
eventdate = formatdatetime(thisdate,vbLongdate)
response.write "<table width='98%' cellspacing='0' cellpadding='0'><tr><td height='20' class='calendar' align='left'>"
response.write "" & eventdate & "</td></tr>"
response.write "<tr><td class='caldetails' valign='top' align='left'>"
response.write RSgetall("venue").value & "
" & RSgetall("details").value
response.write "</td></tr></table>
"
RSgetall.MoveNext
End If
Wend
End If
conn.Close
%>
I think the problem is your .MoveNext is inside the Else of an If statement, so the recordset loops infinitely if the If is true. You want the .MoveNext to happen no matter what the IF Else does so you should put it after End If and before Wend. On a side note people usually use Do While...Loop instead of While...Wend - but I'd have to think too much to give you a reason why :wink:
ok thanks catalyst i never even noticed why!! i got round it anyway, not needing to compare the dates...
but i think i might change it back
that way was easier!
thanks