Sidder med et sært problem jeg ikke kan gennemskue.
Når jeg vil se et skema over en person via et par DropDown-menuer virker det
kun i den første gang. Prøver jeg på en ny person fejler scriptet. Jeg skal
lukke I-Exploreren og åbne den igen for at kunne lave en ny søgning
Er der nogen der har et godt forslag til hvorfor??
testside
http://elevweb.hgmf.dk/skema - siden er lidt tung. Muligvis fordi
databasen er 5-6 MB stor
Kedelig kode lavet af en amatør
____________________________________________________________________________
_________
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-store">
<link rel="stylesheet" type="text/css" href="css/marmor.css" >
<!--#include file="commonadm.inc" -->
<title>SkemaWebben på Handelsgymnasiet Mariager Fjord</title>
<%
Dim rsInit
Dim rsWeek
Session.LCID = 1033
set rsInit = server.createobject("adodb.recordset")
set rsWeek = server.createobject("adodb.recordset")
SQLInit = "SELECT * FROM medarbejdere ORDER BY INITIALER"
SQLGetWeek = "SELECT * FROM TblUger ORDER BY STARTDATO"
rsInit.open SQLInit, conn, 2, 2
rsWeek.open SQLGetWeek, conn, 3,3
%>
<head>
</head>
<html>
<body bgcolor="#FFFFFF" text="#000000">
<div id="Layer1" style="position:absolute; left:197px; top:37px;
width:682px; height:55px; z-index:1">
<table width="99%" height="50" border="0">
<tr>
<form name="FrmCmdVisSkema" method="post" action="" target=_self>
<td width="53%">
<select name="DDInit">
<% do while Not rsInit.EOF %>
<option value="<% = rsInit("INITIALER") %>">
<% = rsInit("INITIALER") %>
-
<% = rsInit("FORNAVN")%>
,
<% = rsInit("EFTERNAVN") %>
</option>
<% rsInit.movenext %>
<% loop %>
</select>
</td>
<td width="33%">
<select name="DDGetWeek">
<% do while Not rsWeek.EOF %>
<option value="<% = rsWeek("STARTDATO") %>">
<% = rsWeek("VISNINGSFORMAT_UGE") %>
</option>
<% rsWeek.movenext %>
<% loop %>
</select>
<td width="14%"><input type="submit" name="CmdVisSkema" value="Vis
Skema"></td>
</form>
</tr>
</table>
</div>
<h3>Vælg initialer og uge ud fra listboksene</h3>
<br>
<br>
<% if request("DDINIT")="" then
' response.write("Vælg først en person fra listen")
Else
Dim Bruger
Dim Dato1
Dim Dato2
Dim Fornavn
Dim Efternavn
Bruger = (Request.Form("DDInit"))
Dato1 = (Request.Form("DDGetWeek"))
Dato2 = DateAdd("d", 5, (Request.Form("DDGetWeek")))
%>
<%
If IsObject(Session("QryVisSkema_rs")) Then
Set rs = Session("QryVisSkema_rs")
Else
' LINIE OK sql = "SELECT skemaer.INITIALER, skemaer.x02_Temp_LEKTIONSNR,
skemaer.UGEDAG, skemaer.x01_Temp_DATO, skemaer.AKTIVITET, skemaer.LOKALENR
FROM skemaer WHERE (((skemaer.INITIALER)= '" & Bruger &"') AND
((skemaer.x01_Temp_DATO)=#"& Dato1 &"#)) ORDER BY skemaer.x01_Temp_DATO ,
skemaer.x02_Temp_LEKTIONSNR "
SQL = "SELECT skemaer.INITIALER, skemaer.x02_Temp_LEKTIONSNR,
skemaer.UGEDAG, skemaer.x01_Temp_DATO, skemaer.AKTIVITET, skemaer.LOKALENR
FROM skemaer WHERE (((skemaer.INITIALER)= '" & Bruger &"') AND
((skemaer.x01_Temp_DATO)Between #"& Dato1 &"# And #"& Dato2 &"#)) ORDER BY
skemaer.x01_Temp_DATO , skemaer.x02_Temp_LEKTIONSNR "
SQLNavn = "SELECT FORNAVN, EFTERNAVN FROM medarbejdere WHERE INITIALER = '"
&BRUGER&"'"
SQLUge = "SELECT VISNINGSFORMAT_UGE FROM TblUger WHERE STARTDATO = #"
&Dato1&"#"
set rsUge = server.createobject("adodb.recordset")
set rsNavn = server.createobject("adodb.recordset")
Set rs = Server.CreateObject("ADODB.Recordset")
rsUge.open SQLUge, conn, 1, 1
rsNavn.open SQLNavn, conn, 2, 2
rs.Open sql, conn, 3, 3
Set Session("QryVisSkema_rs") = rs
End If
%>
<P>
<TABLE width="600" BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD><IMG SRC="billeder/bgpix white marble/topleft.jpg" BORDER="0"
WIDTH="13" HEIGHT="13" ALIGN="bottom" ALT=""></TD>
<TD class="top"></TD>
<TD><IMG SRC="billeder/bgpix white marble/topright.jpg" BORDER="0"
WIDTH="13" HEIGHT="13" ALIGN="bottom" ALT=""></TD>
</TR>
<TR>
<TD class="left"></TD>
<TD class="tekst"><h3>Skema for <%=(rsNavn.Fields("FORNAVN").Value)%>
<spacer> <%=(rsNavn.Fields("EFTERNAVN").Value)%> (<%
Response.Write(Bruger)%>) i <%=(rsUGE.Fields("VISNINGSFORMAT_UGE").Value)%>
</h3>
<table width="548" border=1 cellspacing=0>
<caption>
</caption>
<thead>
<tr>
<TH width="47" BORDERCOLOR=#000000 BGCOLOR=#c0c0c0
><h5>Lektion</h5></TH>
<TH width="92" BORDERCOLOR=#000000 BGCOLOR=#c0c0c0
><h5>Dag</h5></TH>
<TH width="104" BORDERCOLOR=#000000 BGCOLOR=#c0c0c0
><h5>Dato</h5></TH>
<TH width="180" BORDERCOLOR=#000000 BGCOLOR=#c0c0c0
><h5>Fag</h5></TH>
<TH width="103" BORDERCOLOR=#000000 BGCOLOR=#c0c0c0
><h5>Lokale</h5></TH>
</tr>
</thead>
<tbody>
<%
On Error Resume Next
do while Not rs.eof
%>
<tr valign=TOP>
<TD BORDERCOLOR=#c0c0c0 ALIGN=RIGHT><font size="2" face="Arial,
Helvetica,
sans-serif"><%=(rs.Fields("x02_Temp_LEKTIONSNR").Value)%></font></TD>
<TD BORDERCOLOR=#c0c0c0 ><font size="2" face="Arial, Helvetica,
sans-serif"><%=(rs.Fields("UGEDAG").Value)%></font></TD>
<TD BORDERCOLOR=#c0c0c0 ALIGN=RIGHT><font size="2" face="Arial,
Helvetica, sans-serif"><%=(rs.Fields("x01_Temp_DATO").Value)%></font></TD>
<TD BORDERCOLOR=#c0c0c0 ><font size="2" face="Arial, Helvetica,
sans-serif"><%=(rs.Fields("AKTIVITET").Value)%></font></TD>
<TD BORDERCOLOR=#c0c0c0 ><font size="2" face="Arial, Helvetica,
sans-serif"><%=(rs.Fields("LOKALENR").Value)%></font></TD>
</tr>
<%
rs.MoveNext
loop%>
<%
rsInit.close : Set rsInit = Nothing
rsWeek.close : Set rsWeek = Nothing
rs.close : set rs=nothing
rsNavn.close : Set rsNavn = Nothing
rsUge.close : Set rsUge = Nothing
conn.close : set conn=Nothing
set bruger = nothing
set dato1 = nothing
set dato2 = nothing
%>
</tbody>
<tfoot>
</tfoot>
</table>
</A>
. </TD>
<TD class="right"></TD>
</TR>
<TR>
<TD><IMG SRC="billeder/bgpix white marble/bundleft.jpg" BORDER="0"
WIDTH="13" HEIGHT="13" ALT=""></TD>
<TD class="bund"></TD>
<TD><IMG SRC="billeder/bgpix white marble/bundright.jpg" BORDER="0"
WIDTH="13" HEIGHT="13" ALT=""></TD>
</TR>
</TABLE>
<%end if %>
</body>
</html>
____________________________________________________________________________
_________