Vad är felet??? Jag ska göra ett script som skriver om det medelandet som man läser till read="1" Onödig med en Redirect. Testa istället med:Hur ska det vara????[LÖST]
messages.asp
innehåller en länk
" target="mitten"><%=RecSet("rubrik")%>
read_message1.asp
Sidan som ska skriva om medelandet som man ska läsa till read="1"
<code>
<!-- # include file="adovbs.inc" -->
<%
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("db/messages.mdb")&";"
Connect.Execute "UPDATE messages SET read = 1 WHERE tillID =" &Session("ID") &" AND read = "& ("0")
Connect.close
Set Connect = nothing
Response.Redirect "read_message.asp?readID =" &Request.QueryString("readID")
%>
read_message.asp
Sidan som man läser medelandet i
I den här filen får jag felmedelandet
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'ID = AND tillID = 6'.
/muffinman/db/Acomunity/read_message.asp, line 10
<code>
<LINK REL=stylesheet HREF="style.css" TYPE="text/css">
<%
Dim RecSet
Dim Connect
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath ("db/messages.mdb")
Set RecSet = Server.CreateObject("ADODB.Recordset")
RecSet.Open "SELECT * FROM messages WHERE ID = " & Request.QueryString("readID") &" AND tillID = "& Session("ID") , Connect
If RecSet.EOF Then
Response.Write "<H5>Det uppstod ett fel!</H5>"
Else
%>
<table width="430" cellspacing="0" cellpadding="0" align="top" valign="top">
<tr>
<td height="15" width="430" background="http://www21.brinkster.com/muffinman/db/Acomunity/images/tables/Top_Main.gif" align="middle"><font color="#ffffff"><%=RecSet("rubrik")%></font>
</tr>
</table>
<table cellspacing="0" cellpadding="2" width="430">
<tr>
<td height="284" width="430" class="boxlook" valign="top">
<%=RecSet("text")%>
</tr>
</table>
<table cellspacing="0" cellpadding="0" width="430">
<tr>
<td height="12" width="430" background="http://www21.brinkster.com/muffinman/db/Acomunity/images/tables/Bottom_Main.gif">
</tr>
</table>
<%
End If
RecSet.Close
Set RecSet = Nothing
Connect.Close
Set Connect = Nothing
%>Sv: Hur ska det vara????
Hej
Kolla att du får med ett värde i din querystring, för om du kollar felmeddelandet så ser du att readID inte är med.
Jag brukar alltid göra en koll om jag får med ett värde, får jag det så ställer jag SQL frågan, om inte så visar jag ett felmeddelande.
/Anna-KarinSv: Hur ska det vara????
messages.asp
<code>
" target="mitten"><%=RecSet("rubrik")%>
</code>
read_message.asp
<code>
<!-- # include file="adovbs.inc" -->
<LINK REL=stylesheet HREF="style.css" TYPE="text/css">
<%
Dim RecSet
Dim Connect
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath ("db/messages.mdb")
Set RecSet = Server.CreateObject("ADODB.Recordset")
RecSet.Open "SELECT * FROM messages WHERE ID = " & Request.QueryString("readID") &" AND tillID = "& Session("ID") , Connect
If RecSet.EOF Then
Response.Write "<H5>Det uppstod ett fel!</H5>"
Else
%>
<table width="430" cellspacing="0" cellpadding="0" align="top" valign="top">
<tr>
<td height="15" width="430" background="http://www21.brinkster.com/muffinman/db/Acomunity/images/tables/Top_Main.gif" align="middle"><font color="#ffffff"><%=RecSet("rubrik")%></font>
</tr>
</table>
<table cellspacing="0" cellpadding="2" width="430">
<tr>
<td height="284" width="430" class="boxlook" valign="top">
<%=RecSet("text")%>
</tr>
</table>
<table cellspacing="0" cellpadding="0" width="430">
<tr>
<td height="12" width="430" background="http://www21.brinkster.com/muffinman/db/Acomunity/images/tables/Bottom_Main.gif">
</tr>
</table>
<%
If RecSet("read") = 0 Then
Connect.Execute "UPDATE messages SET read = 1 WHERE ID = " & Request.QueryString("readID") &" AND tillID = "& Session("ID")
End If
End If
RecSet.Close
Set RecSet = Nothing
Connect.Close
Set Connect = Nothing
%>
</code>