<% von=Request("von") bis=Request("bis") pos=0 step=20 if Request("p")>"" then pos=Request("p") if Right(von,1)="." then von=von&year(now) if Right(bis,1)="." then bis=bis&year(now) %> Termine <% accept=true %> <%CheckEntry(von)%> <%CheckEntry(bis)%> <%if accept then%> <%if DateValue(von)<=DateValue(bis) then%>
Zeitraum

<% Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "ae19_nms" sql = "SELECT * FROM termine where datum >= DateValue('" & von & "')" &_ " and datum <= DateValue('" & bis & "')" &_ " order by datum, beginn" Set RS = Server.CreateObject("ADODB.RecordSet") RS.Open sql, Conn, 1,1 count=RS.RecordCount %>

<%=count%> Termine - vom <%= von%> bis <%= bis%> <% date_temp="" m_index=pos if Pos>0 then RS.Move(pos) Do While Not RS.EOF if m_index=pos+step then Exit Do m_index=m_index+1 %> <% if date_Temp<>RS("datum") then%> <% End if %> <% date_temp = RS("datum") RS.MoveNext Loop RS.Close Conn.Close %>
<%= FormatDateTime(RS("datum"),vbLongDate)%>
<% if RS("beginn")>"" then %> <%=FormatDateTime(RS("beginn"),vbShortTime)%> <%end if%>  <%=RS("thema")%>   <% if RS("ende")>"" then %>
bis  <%=FormatDateTime(RS("ende"),vbShortTime)%>  <% End if%>
<%if RS("ort")>"" then %> <%=RS("ort")%> <%else%>  <%end if%>
<%if m_index-step-1>0 then%> Zurück  <%end if%> <%if m_index  Weiter <%end if%>

<% '================================================== ' Fehler Antwort '================================================== %> <%else%>
Das Datum <%=bis%> ist kleiner als <%=von%> <%end if%> <%else%>

<%end if%> <% function CheckEntry(str) if(len(str)=0) then response.write("
Ein Feld ist leer") accept=false Exit Function end if CheckChr(str) end function function CheckChr(str) for i = 1 to len(str) ch = mid(str,i, 1) 'response.write("ch: "&ch&"
") if ((ch < "0" or "9" < ch) and not ch = ".") then response.write("
Im Datum "&str&" gibt es unerlaubte Zeichen
") accept=false Exit Function end if next if accept then CheckDate(str) end function function CheckDate(str) idx=0 t="" m="" j="" for i = 1 to len(str) ch = mid(str,i, 1) if (ch = ".") then idx=idx+1 ch="" end if if (idx = 0) then t=t+ch if (idx = 1) then m=m+ch if (idx = 2) then j=j+ch next h=now if (j="") then j=year(h) 'response.write(" vor testdate: "&t&"."&m&"."&j&"
") accept=false if m>"" then if ((m>=1) and (m<=12)) then if((t>=1) and (t<=31)) then if ( not((t>30) and ((m=2) or (m=4) or (m=6) or (m=9) or (m=11) ))) then if (not((m=2) and (t>29))) then if (((m=2) and (t=29))) then if (j mod 4 = 0) then if ( ((j mod 100 > 0) or (j mod 100 > 0)) or ((j mod 100 =0) and (int(j/100) mod 4 =0 )) ) then accept=true end if end if else accept=true end if end if end if end if end if end if if ( not accept) then response.write("
das Datum: "&t&"."&m&"."&j&" existiert nicht
") End Function %>