Lille dato problem... hjælp!!
Kære alleJeg har overtaget følgende script, som virker fint med dags dato (date) men når man laver en querystring beholder den dags dato... jeg tænker nogle skarpe hjerner kan hjælpe mig :) det er til at mødebooking system...
<%
dim strDato
if request.querystring("strDato") = "" then
strDato = date()
else
strDato = DateValue(request.querystring("strDato"))
end if
%>
<html>
<head>
<link rel="stylesheet" href="Style.css">
</head>
<body bgcolor="#f9f7f2">
<b>Sonne TEST<br>
<font size="2">TEST</font></b><p>
<%
dim id
id = 38
%>
<%
dim cn, rs1, rs2, sql1, sql2, startdate, enddate
startdate = datepart("yyyy",date()) & "-" & datepart("m",date()) & "-" & datepart("d",date())
enddate = datepart("yyyy",date()+1) & "-" & datepart("m",date()+1) & "-" & datepart("d",date()+1)
set cn = server.CreateObject("adodb.connection")
set rs1 = server.createobject ("adodb.recordset")
set rs2 = server.createobject ("adodb.recordset")
cn.ConnectionString = "DSN=xxxx;user id=xxxx;password=xxxx"
cn.Open
rs1.ActiveConnection = cn
rs1.CursorType = 1
rs1.LockType = 1
rs1.CursorLocation = 3
rs1.ActiveConnection = cn
rs1.CursorType = 1
rs1.LockType = 1
rs1.CursorLocation = 3
sql1 = "select reservation_id, start_time, end_time "
sql1 = sql1 & "from reservation "
'sql1 = sql1 & "where start_time>=getdate() and end_time<=getdate()+1 "
sql1 = sql1 & "where start_time>='" & startdate & "' and end_time<'" & enddate & "' "
sql1 = sql1 & "and deleted is null "
sql1 = sql1 & "and address_resource_id = " & id & " "
sql1 = sql1 & "union "
sql1 = sql1 & "select reservation_id, start_time, end_time "
sql1 = sql1 & "from booking "
sql1 = sql1 & "where start_time>='" & startdate & "' and end_time<'" & enddate & "' "
sql1 = sql1 & "and resource_id = " & id & " "
sql1 = sql1 & "order by start_time "
rs1.open sql1, cn
'response.write formatdatetime(date()) & "<p>" + vbcr
if rs1.eof then
response.write "<font style='font-size: 11pt'>Ingen møder i dag</font>"
end if
while not rs1.eof
sql2 = "select p.firstname, p.lastname "
sql2 = sql2 & "from participant p inner join reservationparticipant rp on p.participant_id=rp.participant_id "
sql2 = sql2 & "where rp.reservation_id = " & rs1("reservation_id") & " "
sql2 = sql2 & "and (p.is_external=0)"
rs2.open sql2, cn
response.write "<font style='font-size: 11pt'>" & left(formatdatetime(DateAdd("h",1,rs1("start_time")),3),5) & " - " & left(formatdatetime(DateAdd("h",1,rs1("end_time")),3),5) & "</font><br>" + vbcr
response.write "<font style='font-size: 11pt'>Mødearrangør(er):</font><br>" + vbcr
while not rs2.eof
response.write "<font style='font-size: 11pt'>" & rs2("firstname") & " " & rs2("lastname") & "<br></font>" + vbcr
rs2.movenext
wend
response.write "<p style='font-size: 5pt' align='center'>________________________</p>" + vbcr
rs2.close
rs1.movenext
wend
rs1.close
set rs1=nothing
set rs2=nothing
cn.close
set cn=nothing
%>
</body>