Jag vill få så som lunar har på sin sidan att om det har kommit ett nytt gb inlägg så ska en bild blinka annars inte. men det går inte så bra. Det finns ingen post som uppfyller ditt villkor. Du får lägga till en kontroll för att se om det finns något att uppdatera. Sen så försöker du använda recset efter det att det är stängt och satt till nothing. Jag ändrade en liten kod men e det inte så att databasen inte updateras när man går till raden där den ska updateras i en databas genom en länk som på sistaraden med tillID osv.Gastbok
Jag hadde tänkt mig att göra så att när man går in i gastboken ska alla medelanden som inte har read="1" ska bli 1. Men det funkar inge vidare
Sidan som länkar till gästboken:---------------------->
menu1:
<!-- #include file="adovbs.inc" -->
<% Session.lcid = 1053 %>
<%
If Session("login") <> "ok" Then
Session("meddelande") = "You have to be online!"
Response.Redirect "login.asp"
End If
%>
<%
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("db/db.mdb")&";"
Set RecSet = Server.CreateObject("ADODB.Recordset")
Addera = "Select * From tblUsers"
RecSet.Open Addera, Connect, adOpenStatic, adLockOptimistic
%>
<% dim datum
datum = DateAdd("h",6,Now)
%>
<html>
<head>
<LINK REL=stylesheet HREF="style.css" TYPE="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="sv">
</head>
<body align="top" valign="top">
<b>" target="frame">" target="frame">" target="_top"> </b><br>
</html>
-------------------------------------------------------------------------
Sidan som ska göra så att medelandena med 0 ska bli 1: ------------>
felmedelandet i gastbok1:
ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/muffinman/db/Acomunity/gastbok1.asp, line 13
gastbok1:
<!-- #include file="adovbs.inc" -->
<%
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("db/gb.mdb")&";"
Set RecSet = Server.CreateObject("ADODB.Recordset")
Addera = "select * from gb where ID="&Session("ID")
RecSet.Open Addera, Connect, AdopenKeyset, adLockOptimistic
RecSet("read") = "1" 'Line 13
RecSet.Update
RecSet.Close
Connect.close
Set RecSet = nothing
Set Connect = nothing
Response.Redirect "gastbok.asp?tillID =" & RecSet("ID")
%>
---------------------------------------------------------------
Gästboken---------------------------------------->
gastbok:
<!-- #include file="adovbs.inc" -->
<LINK REL=stylesheet HREF="style.css" TYPE="text/css">
<%
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath ("db/gb.mdb")
Set RecSet = Server.CreateObject("ADODB.Recordset")
Addera = "Select * From gb Where tillID = "&Request.QueryString("tillID") &" Order By Datum DESC"
RecSet.Open Addera, Connect, adOpenStatic, adLockOptimistic
%>
<table cellspacing="0" width="410">
<tr>
<td class="boxlooktop" width="410"><p align="center"><b>NAME</b></p>
</tr>
</table>
<table width="584" border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="400" class="boxlook">
<% do until recset.EOF %>
<table border="0" width="100%" cellspacing="1" cellpadding="0"><tr>
<td height="10" width="100%"> " target="front"><%=RecSet("namn")%> |
">Svara | ">Delete | <%=RecSet("datum")%>
</td></tr><tr valign="top"><td width="100%">
<table border="0" width="100%" cellspacing="0" cellpadding="2"><tr><td>
" target="front">" width="35" align="left" height="45" border="1">
<%
Dim strMess
strMess = Server.HTMLEncode(RecSet("text"))
strMess = Replace(strMess,"[KOM]","")
strMess = Replace(strMess,"[/KOM]","")
strMess = Replace(strMess,"[Kom]","")
strMess = Replace(strMess,"[/Kom]","")
strMess = Replace(strMess,"[kom]","")
strMess = Replace(strMess,"[/kom]","")
strMess = Replace(strMess,"[B]","<b>")
strMess = Replace(strMess,"[/B]","</b>")
strMess = Replace(strMess,"[b]","<b>")
strMess = Replace(strMess,"[/b]","</b>")
strMess = Replace(strMess,"[I]","<i>")
strMess = Replace(strMess,"[/I]","</i>")
strMess = Replace(strMess,"[i]","<i>")
strMess = Replace(strMess,"[/i]","</i>")
strMess = Replace(strMess,"[U]","<u>")
strMess = Replace(strMess,"[/U]","</u>")
strMess = Replace(strMess,"[u]","<u>")
strMess = Replace(strMess,"[/u]","</u>")
strMess = Replace(strMess,"[LINK]","")
strMess = Replace(strMess,"[/LINK]","")
strMess = Replace(strMess,"[Link]","")
strMess = Replace(strMess,"[/Link]","")
strMess = Replace(strMess,"[link]","")
strMess = Replace(strMess,"[/link]","")
Response.Write strMess
%>
</td></tr></table>
</td></tr></table><br>
<%
RecSet.MoveNext
Loop
RecSet.Close
Connect.Close
Set RecSet = nothing
Set Connect = nothing
%>
</td>
</td>
<td width="165" align="right" rowspan="2">
<table>
<tr>
<td>
<table cellspacing="0">
<tr>
<td class="boxlooktop" width="165"><p align="center"><b>MESSAGE</b></p>
</tr>
</table>
<table width="165" cellpadding="4" cellspacing="0">
<tr>
<td width="155" class="boxlook" align="center">
<form name="form1" method="post" action="gb_spara.asp?tillID=<%=Request.QueryString("tillID")%>">
<input type="hidden" name="Bild" value="<%=Session("Bild")%>">
<textarea name="text" cols="25" rows="4"></textarea>
<div align="center"><input type="submit" name="Submit" value="Send"></div>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
--------------------------------------------------
Sv: Gastbok
<%
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("db/gb.mdb")&";"
Set RecSet = Server.CreateObject("ADODB.Recordset")
Addera = "select * from gb where ID="&Session("ID")
RecSet.Open Addera, Connect, AdopenKeyset, adLockOptimistic
if not recset.eof then
RecSet("read") = "1" 'Line 13
RecSet.Update
end if
RecSet.Close
Connect.close
Set RecSet = nothing
Set Connect = nothing
Response.Redirect "gastbok.asp?tillID =" & Session("ID")
%> Sv: Gastbok
<%
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("db/gb.mdb")&";"
Set RecSet = Server.CreateObject("ADODB.Recordset")
Addera = "select * from gb where ID="&Session("ID")
RecSet.Open Addera, Connect, AdopenKeyset, adLockOptimistic
if not recset.eof then
RecSet("read") = "1"
RecSet.Update
end if
RecSet.Close
Connect.close
Set RecSet = nothing
Set Connect = nothing
Response.Redirect "gastbok.asp?tillID =" & Session("ID")
%>
Började även på en if sats men det gick inte så bra nu visar ju ifsatsen biler för varje inlägg som finns i sin egen gästbok varför
<!-- #include file="adovbs.inc" -->
<% Session.lcid = 1053 %>
<%
If Session("login") <> "ok" Then
Session("meddelande") = "You have to be online!"
Response.Redirect "login.asp"
End If
%>
<%
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("db/gb.mdb")&";"
Set RecSet = Server.CreateObject("ADODB.Recordset")
Addera = "Select * From gb where tillID="&Session("ID")
RecSet.Open Addera, Connect, adOpenStatic, adLockOptimistic
%>
<% dim datum
datum = DateAdd("h",6,Now)
%>
<html>
<head>
<LINK REL=stylesheet HREF="style.css" TYPE="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="sv">
</head>
<body align="top" valign="top" background="images/menu.gif">
<table>
<tr>
<td>
<br>
</br>
<br>
</br>
<br>
</br>
<br>
</br>
<br>
</br>
<%
DO Until RecSet.EOF
%>
<%if recset("read") = "0" then%> <img src="images/online.gif" width="8" height="8"> <%else%> <img src="images/offline.gif" width="8" height="8"> <%end if%>
<%
RecSet.movenext
loop
RecSet.Close
Connect.Close
Set RecSet = nothing
Set Connect = nothing
%>
</tr>
</table>
</html>