Jeg får en syntax error, og jeg kan ikke finde fejlen
Jeg har stirret mig totalt blind på min kode, og jeg kan bare ikke finde min fejl. HJÆLP migHer er fejlen jeg får:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'id ='.
/test/nyhed/gemret.asp, line 8
Her er sourcekoden
<%
response.buffer = true
set conn = server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)}; dbq=" & server.mappath("nyhed.mdb")
sqlstmt = "update distinctrow data set dato1 = '" & request.form("dato1") & "', dato2 = '" & request.form("dato2") & "', dato3 = '" & request.form("dato3") & "', overskrift = '" & request.form("overskrift") & "', tekst = '" & request.form("tekst") & "' where id = " & request("id")
conn.execute (sqlstmt)
conn.close
Set conn = nothing
set sqlstmt = nothing
response.redirect ("admin.asp")
%>
Her er filen der redirecter til denne kode:
<html>
<head>
<title> ::: Autonorden ::: </title>
</head>
<body>
<%
set conn = server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)}; dbq=" & server.mappath("nyhed.mdb")
sqlstmt = "select * from data where id = " & request("id")
conn.execute (sqlstmt)
set rs = conn.execute(sqlstmt)
%>
<font face="verdana">
<center>
<a href="admin.asp">Tilbage til Administration</A>
<br>
<form method="post" action="gemret.asp">
<table width="95%" cellpadding="5" cellspacing="0" border="1" bordercolor="#000000">
<tr>
<td width="30%" valign="top"><b>Dato:</b></td>
<td width="70%" valign="top">
<select name="dato1">
<option selected><%=rs("dato1")%>
<option value="01">01
<option value="02">02
<option value="03">03
<option value="04">04
<option value="05">05
<option value="06">06
<option value="07">07
<option value="08">08
<option value="09">09
<option value="10">10
<option value="11">11
<option value="12">12
<option value="13">13
<option value="14">14
<option value="15">15
<option value="16">16
<option value="17">17
<option value="18">18
<option value="19">19
<option value="20">20
<option value="21">21
<option value="22">22
<option value="23">23
<option value="24">24
<option value="25">25
<option value="26">26
<option value="27">27
<option value="28">28
<option value="29">29
<option value="30">30
<option value="31">31
</select>
<select name="dato2">
<option selected><%=rs("dato2")%>
<option value="Januar">Januar
<option value="Februar">Februar
<option value="Marts">Marts
<option value="April">April
<option value="Maj">Maj
<option value="Juni">Juni
<option value="Juli">Juli
<option value="August">August
<option value="September">September
<option value="Oktober">Oktober
<option value="November">November
<option value="December">December
</select>
<select name="dato3">
<option selected><%=rs("dato3")%>
<option value="2002">2002
<option value="2003">2003
<option value="2004">2004
<option value="2005">2005
</select>
</tr>
<tr>
<td width="30%" valign="top"><b>Overskrift:</b></td>
<td width="70%" valign="top"><input type="text" name="overskrift" size="75" value="<%=rs("overskrift")%>">
</td>
</tr>
<tr>
<td width="30%" valign="top"><b>Tekst:</b></td>
<td width="70%" valign="top"><textarea name="tekst" rows="5" cols="65"><%=replace(rs("tekst"), vbcrlf, "<br>" & vbcrlf)%></textarea></td>
</tr>
</table>
<br>
<input type="submit" value="Send">
</form>
</center>
</font>
<%
conn.Close
set conn = nothing
set sqlstmt = nothing
%>
</body>
</html>
Og her er koden der starter det hele:
<html>
<head>
<title> ::: Autonorden ::: </title>
<style>
p { text-align: justify }
body { font-family: verdana; font-weight: bold }
td { font-family: verdana; font-weight: bold }
input { font-family: verdana; font-weight: bold; background-color: #ccccff; color: #0000aa }
textarea { font-family: verdana; font-weight: bold; background-color: #ccccff; color: #0000aa }
select { font-family: verdana; font-weight: bold; background-color: #ccccff; color: #0000aa }
</style>
</head>
<body bgcolor="#ffffff" text="#0000aa" link="#0000aa" alink="#0000aa" vlink="#0000aa">
<%
set conn = server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)}; dbq=" & server.mappath("nyhed.mdb")
sqlstmt = "select * from data order by id desc"
conn.Execute (sqlstmt)
set rs = conn.execute(sqlstmt)
%>
<font face="verdana" size="2">
<center>
<a href="indtastny.asp"><b>Indtast Nyhed</b></a> <a href="../admin/adminmenu.asp">Tilbage til Admin Menu</a>
<br><br>
<table width="95%" cellpadding="5" cellspacing="0" border="1" bordercolor="#000000">
<tr>
<td align="center" width="100%"><font size="4"><b>Nyheder</b></font></td>
</tr>
</table>
<br>
<table width="95%" cellpadding="5" cellspacing="0" border="1" bordercolor="#000000">
<%
do while not rs.eof
%>
<tr>
<td width="30%"><font size="2"><a href="vis.asp?id=<%=rs("id")%>"><b><%=rs("dato1")%> <%=rs("dato2")%> <%=rs("dato3")%></b></a></font></td>
<td width="70%"><font size="2"><a href="vis.asp?id=<%=rs("id")%>"><b><%=rs("overskrift")%></b></a></font></td>
</tr>
<%
rs.movenext
loop
rs.close
conn.close
set conn = nothing
set sqlstmt = nothing
%>
</table>
</font>
</body>
</html>