Dobbelt Udskrivelse
Mit problem ligger i at mit ASP document udskriver dataen to gange istedet for at nøjes med en gang. Jeg er klar over at min kildekode er lidt overskuelig og primitiv, men jeg er ikke den bedste i ASP og det at jeg skal arbejde på tværs af flere databaser gøre det bare endnu sværer.. anyway here you go:'validering, dobbel checking
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("db/system.mdb")
Conn.Open DSN
strSQL = "Select * from mail where id = "& Request.Querystring("id")
Set rs = Conn.Execute(strSQL)
if not session("navn") = rs("to") then
response.redirect "index.asp"
end if
Conn.Execute(strSQL)
Conn.Close
Set Conn = Nothing
'validering slut
%>
<!--#INCLUDE FILE="../community/level1.inc"-->
<table width="100%">
<tr>
<td colspan="3">
<span class="maintitle">anime [question mark] | <u>read PM</u></span>
<br>
</td>
</tr>
</table>
<table cellspacing="0" width="100%">
<!--#INCLUDE FILE="pmenu.inc"-->
</table>
<table width="390">
<tr>
<td rowspan="3" valign="top">
<%
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("db/system.mdb")
Conn.Open DSN
strSQL = "Select * from login where username = '" & Request.Querystring("username") & "'"
Set rs = Conn.Execute(strSQL)
if rs.eof then
response.write "<p> </p><center>No avartar</center>"
else
do
%>
<img src="<%= rs("billede")%>">
<%
rs.MoveNext
Loop While Not rs.EOF
end if
Conn.Close
Set Conn = Nothing
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("db/system.mdb")
Conn.Open DSN
strSQL = "Select * from mail where id = " & Request.Querystring("id")
Set rs = Conn.Execute(strSQL)
if rs.eof then
response.write "<p> </p><center>HTTP 404 - Page not found! This PM does not exist!</center>"
else
do
%>
</td>
<td width="100%" valign="top" class="gentiny">
From: <%= rs("from")%>
<br>
<%
rs.MoveNext
Loop While Not rs.EOF
end if
Conn.Close
Set Conn = Nothing
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("db/system.mdb")
Conn.Open DSN
strSQL = "Select * from login where username = '" & Request.Querystring("username") & "'"
Set rs = Conn.Execute(strSQL)
if rs.eof then
response.write "<p> </p><center>No avartar</center>"
else
do
%>
title:
<% if rs("Clearance") = 1 then %>
<font color="#000000">
<% elseif rs("Clearance") = 2 then %>
<font color="#006600">
<% elseif rs("Clearance") = 3 then %>
<font color="#0066CC">
<% end if %>
<%= rs("rank")%>
</font>
<br>
<%
rs.MoveNext
Loop While Not rs.EOF
end if
Conn.Close
Set Conn = Nothing
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("db/system.mdb")
Conn.Open DSN
strSQL = "Select * from mail where id = " & Request.Querystring("id")
Set rs = Conn.Execute(strSQL)
if rs.eof then
response.write "<p> </p><center>HTTP 404 - Page not found! This PM does not exist!</center>"
else
do
%>
Date: <%= rs("dato")%> | <%= rs("tid") %>
<br>
<a href="index.asp?method=profile&name=<%= rs("from")%>">profile</a> |
<a href="index.asp?method=pm&id=<%= rs("id")%>" class="gen">delete</a>
</td>
</tr>
<tr><td></td></tr>
<tr>
<td>
<span class="maintitle"><u><%= rs("subject")%></u></span>
<br>
<%= Replace(rs("besked"),chr(13),"<br>") %>
</td>
</tr>
</table>
<%
rs.MoveNext
Loop While Not rs.EOF
end if
Conn.Close
Set Conn = Nothing
%>
