Annonceindlæg fra Infor
25. marts 2005 - 13:34
#1
Jeg forstår ikke hvorfor det jeg lavede sidst ikke blev godtaget, men det her virker nu fint: <!-- #include file="dbconn.asp" --> <% SQL = "SELECT * From EW_HTML_Document order by ID Desc" set rs = conn.execute(SQL) while not rs.eof or rs.bof LastCount = rs("id") -1 strSQL = "SELECT COUNT(*) AS antal FROM EW_HTML_Document WHERE id > " & lastCount set rsCount = conn.execute(strSQL) response.write(rsCount("antal")) LastCount = rs("id") rs.movenext wend %>
25. marts 2005 - 14:13
#3
Nu bruger jeg denne her:
SQL = "SELECT * FROM communications order by id Desc"
set rs = conn.execute(SQL)
while not rs.eof or rs.bof
LastCount = rs("id") -1
strSQL = "SELECT COUNT(*) AS antal FROM communications WHERE id > " & lastCount
set rsCount = conn.execute(strSQL)
response.write(rsCount("antal"))
LastCount = rs("id")
wend
Men kan ikke komme ind på siden. Den står bare og loader:
http://www.team-nopanic.dk/communications_version_1/default.asp
25. marts 2005 - 16:31
#11
Kan altså ikke få den til at virke. Lige meget hvordan jeg flytter på på koden, så bliver den bare ved med at loade. Nu poster jeg lige koden, og håber på at i kan vise mig hvordan den skal se ud :) __________________________________________ <% response.write("<table width='630' align='center' cellpadding='3' cellspacing='0' class='textnavigation'>") response.write("<tr>") response.write("<td>Communications</td>") response.write("</tr>") response.write("</table>") response.write("<br>") 'Åbner databasen set conn = opendb() strMode = Request.QueryString("mode") 'Tilføj besked select CASE strMode CASE "addmessage" author = request.cookies("nick") email = request.cookies("email") if request.form("mode") = "insert" then topic = replace(Trim(request.form("topic")),"'","''") body = replace(Trim(request.form("body")),"'","''") bodyStr = replace(body,vbcrlf,"<br>") author = Trim(request.form("nick")) email = Trim(request.form("email")) website = Trim(request.form("website")) ierr = 0 if author = "" then ierr = 1 errormsg = errormsg + "<br><li>Du skal skrive et navn</li>" end if if topic = "" then ierr = 1 errormsg = errormsg + "<br><li>Du skal skrive en overskrift</li>" end if if body = "" then ierr = 1 errormsg = errormsg + "<br><li>Du skal skrive en besked</li>" end if 'Udskriver fejlene response.write("<table width='630' align='center' cellpadding='5' cellspacing='5' class='texterror'>") response.write("<td colspan='2'> " & "Følgende fejl opstod:" & errormsg & "</font><br></td>") response.write("</table>") if ierr = 0 then SQL = "insert into communications(author, email, website, topic, body, ip) values('" SQL = SQL & author & "','" SQL = SQL & email & "','" SQL = SQL & website & "','" SQL = SQL & topic & "','" SQL = SQL & bodyStr & "','" SQL = SQL & Request.ServerVariables("REMOTE_ADDR") & "')" set RSinsert = conn.Execute(SQL) if request.form("remember") = "true" then Response.cookies("communication")("nick") = author Response.cookies("communication")("email") = email Response.Cookies("communication").Expires = Date+365 end if response.redirect("default.asp") end if end if response.write("<form name='form1' method='post' action='default.asp?mode=addmessage'><input type='hidden' name='mode' value='insert'>") response.write("<table width='630' align='center' cellpadding='3' cellspacing='0' class='textnormal'>") response.write("<tr>") response.write("</tr>") response.write("<tr>") response.write("<td width='153'>Navn: * </td>") response.write("<td width='455'><input name='nick' type='text' id='nick' value='" & author & "' class='textfields' size='86'></td>") response.write("</tr>") response.write("<tr>") response.write("<td>E-mail: *</td>") response.write("<td width='455'><input name='email' type='text' class='textfields' id='email' value='" & email & "' size='86'></td>") response.write("</tr>") response.write("<tr>") response.write(" <td>Website:</td>") response.write("<td height='24' width='455' valign='top'><input name='website' type='text' class='textfields' id='website' value='" & website & "' size='86'></td>") response.write("</tr>") response.write("<tr>") response.write(" <td height='24'>Overskift: *</td>") response.write("<td valign='bottom'><input name='topic' type='text' class='textfields' id='topic' value='" & topic & "' size='86'></td>") response.write("</tr>") response.write("<tr>") response.write("<td valign='top'>Besked: *</td>") response.write("<td width='455' valign='top' class='textsmall'>") response.write("<textarea name='body' cols='86' class='textareas' onselect='storeCaret(this);' onchange='storeCaret(this);countLetters(this);' onclick='storeCaret(this);' onkeydown='storeCaret(this);countLetters(this);' onkeyup='storeCaret(this);countLetters(this);'>"& body &"</textarea>") response.write("<br>") response.write("Din besked må maksimalt være på 700 tegn - du har <span id='lettercount'>700</span> tegn tilbage.") response.write("<br>") response.write("<td width='2'></td>") response.write("</tr>") response.write("<tr>") response.write("<td height='36' valign='top'>Husk mine informationer:<br>") response.write("<font color ='cccccc'>(Ved brug af Cookies)</font></td>") response.write("<td height='40' valign='top'><input name='remember' type='checkbox' class='checkbox' id='remember' value='checkbox'></td>") response.write("</tr>") response.write("<tr>") response.write("<td></td>") response.write("<td><input name='Submit' type='submit' class='submitfield' value='Opret beskeden'></td>") response.write("</tr>") response.write("<tr>") response.write("<td height='40' valign='bottom'> »<a href='default.asp'> Tilbage til Communications</a></td>") response.write("<td></td>") response.write("</tr>") response.write("</table>") response.write("</form>") 'Besked oversigt CASE ELSE response.write("<table width='630' align='center' cellpadding='3' cellspacing='0'>") response.write("<tr>") response.write("<td height='23' align='center' valign='top' class='textheader'><a href='default.asp?mode=addmessage'>Tilføj besked</a></td>") response.write("</tr>") response.write("<tr>") response.write("<td>") response.write("</td>") response.write("</tr>") response.write("<tr>") response.write("<td align='center' valign='top' class='textnormal'>") SQL = "SELECT COUNT(*) as count FROM communications " set RS = conn.execute(SQL) response.write("Beskeder: " &"<b>"& RS("count") &" <br></b>") SQL = "SELECT id, author, body, addeddate, ip, website, email, topic FROM communications " set RS = conn.execute(SQL) 'opbygning af pagingsystem intPage = Request("page") If isNumeric(intPage) = False Or intPage < 1 Then intPage = 1 End If If Not (rs.BOF Or rs.EOF) Then rs.PageSize = 1 rs.AbsolutePage = intPage intRecCount = rs.PageSize intPageCount = rs.PageCount Do While Not rs.EOF And intRecCount > 0 intRecCount = intRecCount - 1 rs.MoveNext Loop End If rs.Close Set rs = Nothing Response.Write "Side: " For intNum = 1 To intPageCount If intPage = intNum Then Response.Write " [" & "<b>" & intNum &"</b>" & "] " Else Response.Write "<a href=default.asp?page=" & intNum & ">" & intNum & "</a> " End If Next response.write("<br>") response.write("<br>") response.write("<tr>") response.write("<td colspan='4' height='1' background='gfx/dot_horizontal.gif'></td>") response.write("</tr>") response.write("</td>") response.write("</tr>") response.write("</table>") response.write("<br>") 'Starter selve tabellen hvori beskeden ligger! response.write("<table width='630' align='center' cellpadding='0' cellspacing='10' class='table_bluelight'>") response.write("<tr>") response.write("<td><table width='100%' border='0' cellpadding='0' cellspacing='0'>") response.write("<tr>") response.write("<td width='63%' height='18'>") 'HER SKAL MIN COUNT LIGGE KÆRE EKSPERTER ;) SQL = "SELECT id, author, body, addeddate, ip, website, email, topic FROM communications ORDER BY addeddate DESC; " set RS = conn.execute(SQL) response.write(" <font color='#' class='textheader'>" & RS("topic") & "") response.write("</td>") response.write("<td width='37%' align='right' valign='top'>") response.write(" <font color='#999999' class='textfade'>" & formatdatetime(RS("addeddate"),1) & " kl. " & formatdatetime(RS("addeddate"),4) & "</a></font> ") response.write("</td>") response.write("</tr>") response.write("</table>") response.write("</td>") response.write("</tr>") response.write("<tr>") response.write("<td><table width='100%' border='0' cellpadding='0' cellspacing='5' class='textnormal'>") response.write("<tr>") response.write("<td>") response.write("" & RS("body") & "") response.write("</td>") response.write("</tr>") response.write("</table>") response.write("</td>") response.write("</tr>") response.write("<tr>") response.write("<td height='18'><table width='100%' border='0' cellpadding='0' cellspacing='0' class='textfade'>") response.write("<tr>") response.write("<td valign='top'>") response.write("// " & RS("author") & "") response.write("</td>") response.write("<td align='right' valign='bottom'>") if not RS("website") = "" then response.write("") response.write("<a href=' " & RS("website") & " ' >") response.write("<img src='gfx/website.gif' alt='Besøg "& RS("author") & "s website'"" width='16' height='16' border='0'></a>") response.write(" ") response.write(" ") else end if if not RS("email") = "" then response.write("") response.write("<a href='mailto:" & RS("email") & " ' >") response.write("<img src='gfx/mail.gif' alt='Skriv en e-mail til "& RS("author") &"'"" width='16' height='16' border='0'></a>") else response.write("") end if response.write("</td>") response.write("</tr>") response.write("</table>") response.write("</td>") response.write("</tr>") response.write("</table>") rs.movenext response.write("<br>") response.write("<table width='630' align='center' cellpadding='3' cellspacing='0' class='textnormal'>") response.write("<tr>") response.write("<td align='center' valign='top' class='textnormal'>") response.write("<tr>") response.write("<td colspan='4' height='1' background='gfx/dot_horizontal.gif'></td>") response.write("</tr>") response.write("</td>") response.write("</tr>") response.write("<tr>") response.write("<td align='center' valign='top' class='textnormal'>") SQL = "SELECT COUNT(*) as count FROM communications " set RS = conn.execute(SQL) response.write("<br>") response.write("Beskeder: " &"<b>"& RS("count") &" <br></b>") SQL = "SELECT id, author, body, addeddate, ip, website, email, topic FROM communications " set RS = conn.execute(SQL) 'opbygning af pagingsystem intPage = Request("page") If isNumeric(intPage) = False Or intPage < 1 Then intPage = 1 End If If Not (rs.BOF Or rs.EOF) Then rs.PageSize = 1 rs.AbsolutePage = intPage intRecCount = rs.PageSize intPageCount = rs.PageCount Do While Not rs.EOF And intRecCount > 0 intRecCount = intRecCount - 1 rs.MoveNext Loop End If rs.Close Set rs = Nothing Response.Write "Side: " For intNum = 1 To intPageCount If intPage = intNum Then Response.Write " [" & "<b>" & intNum &"</b>" & "] " Else Response.Write "<a href=default.asp?page=" & intNum & ">" & intNum & "</a> " End If Next response.write("<br>") response.write("<br>") response.write("</td>") response.write("</tr>") response.write("</table>") response.write("<br>") END SELECT closedb() %>