Den här sidan ska visa bilder som finns i en mapp och sökvägen finns i en databas när jag kör den så hänger sig sidan, varför? <code> Tror... Testa detta:Sidan hänger sig varför?
<!-- #include file="adminpass.asp" -->
<HTML>
<link rel="stylesheet" href="../../Stylesheet.css" type="text/css">
<BODY BGCOLOR="Silver">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50"> </td>
<td>
<FORM METHOD="POST" ACTION="ny_aktuellt_reg.asp" ENCTYPE="multipart/form-data" name="f" id="f">
<table width="500" border="0" cellspacing="0" cellpadding="5" bgcolor="Silver">
<tr>
<td>
<table width="96%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><span class="rubrik">Aktuellt</span><br>
<img src="../../bilder/streck.gif" width="300" height="2">
</td>
</tr>
<tr>
<td><br><span class="brod">Rubrik: </span><br>
<input type="text" name="rubrik" size="57" class="brod">
<br>
<br>
<span class="brod">Text: </span><br>
<textarea name="text" cols="56" rows="10" class="brod"></textarea>
<br>
<br>
<span class="brod">Välj en befintlig bild:</span><br>
<%
Dim colNumber Dim Con
Dim SQL
Dim RS
Dim o
colNumber = 3
Set Con = Server.CreateObject("ADODB.Connection") Con.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ="& Server.MapPath("/admin/databas/db1.mdb")
SQL = "Select path From files"
Set RS = Con.Execute(SQL)
If Not RS.EOF then
Response.Write "<table width=""600"" border=""0"" cellpadding=""0"" cellspacing=""0"">" & vbNewLine
Do Until RS.EOF
Response.Write "<tr>" & vbNewLine
For o = 1 to colNumber
Response.Write "<td align=""left"" valign=""top"">"
If Not RS.EOF then
Response.Write RS("path") & "nbsp;"
Else
Response.Write " "
RS.MoveNext
End If
Response.Write "</td>" & vbNewLine
Next
Response.Write "</tr>"
Loop
Response.Write "</table>" & vbNewLine
End If
RS.Close
Set RS = Nothing
Con.Close
Set Con = Nothing
%>
<br>
<br>
<span class="brod">Eller välj en ny bild att ladda upp:</span><br>
<input type="file" name="FILE1" size="43" class="brod"><br>
<br>
<span class="brod">Namn:</span><br>
<input type="text" name="alias" value="" size="57" class="brod">
<br>
<br>
<input type="submit" value="UPPDATERA" class="brod">
</td>
</tr>
</table>
</td>
</tr>
</table>
</FORM>
</td>
</tr>
</table>
</body>
</html>Sv: Sidan hänger sig varför?
If Not RS.EOF then
Response.Write RS("path") & "nbsp;"
Else
Response.Write " "
RS.MoveNext
End If
</code>
Du stegar endast framåt om du har nått sista posten, eftersom du inte har gjort det kommer sidan hålla på att skriva ut första posten i evigheter...
/JohanSv: Sidan hänger sig varför?
If Not RS.EOF then
Response.Write RS("path") & "nbsp;"
RS.MoveNext
Else
Response.Write " "
RS.MoveNext
End If Sv: Sidan hänger sig varför?
<code>
<!-- #include file="adminpass.asp" -->
<HTML>
<link rel="stylesheet" href="../../Stylesheet.css" type="text/css">
<BODY BGCOLOR="Silver">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50"> </td>
<td>
<FORM METHOD="POST" ACTION="ny_aktuellt_reg.asp" ENCTYPE="multipart/form-data" name="f" id="f">
<table width="500" border="0" cellspacing="0" cellpadding="5" bgcolor="Silver">
<tr>
<td>
<table width="96%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><span class="rubrik">Aktuellt</span><br>
<img src="../../bilder/streck.gif" width="300" height="2">
</td>
</tr>
<tr>
<td><br><span class="brod">Rubrik: </span><br>
<input type="text" name="rubrik" size="57" class="brod">
<br>
<br>
<span class="brod">Text: </span><br>
<textarea name="text" cols="56" rows="10" class="brod"></textarea>
<br>
<br>
<span class="brod">Välj en befintlig bild:</span><br>
<%
Dim colNumber
Dim Con
Dim SQL
Dim RS
Dim o
colNumber = 3
Set Con = Server.CreateObject("ADODB.Connection") Con.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ="& Server.MapPath("/admin/databas/db1.mdb")
SQL = "Select path From files"
Set RS = Con.Execute(SQL)
If Not RS.EOF then
Response.Write "<table width=""600"" border=""0"" cellpadding=""0"" cellspacing=""0"">" & vbNewLine
Do Until RS.EOF
Response.Write "<tr>" & vbNewLine
For o = 1 to colNumber
Response.Write "<td align=""left"" valign=""top"">"
If RS.EOF then
Response.Write " "
Else
Response.Write RS("path") & "nbsp;"
RS.MoveNext
End If
Response.Write "</td>" & vbNewLine
Next
Response.Write "</tr>"
Loop
Response.Write "</table>" & vbNewLine
End If
RS.Close
Set RS = Nothing
Con.Close
Set Con = Nothing
%>
<br>
<br>
<span class="brod">Eller välj en ny bild att ladda upp:</span><br>
<input type="file" name="FILE1" size="43" class="brod"><br>
<br>
<span class="brod">Namn:</span><br>
<input type="text" name="alias" value="" size="57" class="brod">
<br>
<br>
<input type="submit" value="UPPDATERA" class="brod">
</td>
</tr>
</table>
</td>
</tr>
</table>
</FORM>
</td>
</tr>
</table>
</body>
</html>
</code>