Fejl ved opdatering af DB
Hej eksperter...Jeg kan ikke opdatere min database af en eller anden mystisk årsag... Den skriver ikke nogen fejl-meddelelse, skriver bare at der er visse problemer på den side man forsøger at åbne...
Kan en af jer spotte fejlen?
------------------------------------------
Update_item.asp
<%
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("cgi-bin/itemsandmonsters.mdb")
Conn.Open DSN
strSQLItem = "Select * from tbl_Items where id = " & request.querystring("id")
Set rsItem = Conn.Execute(strSQLItem)
%>
<html>
<head>
<title>RSFever</title>
<LINK href="style.css" type=text/css rel=stylesheet>
</head>
<body bgcolor="#000000" text="#FFFFFF" link="#008000" vlink="#008000" alink="#008000">
<form method="POST" action="update_item_handler.asp">
<div align="center">
<center><a href="default.asp">Back</a>
<table border="0">
<tr>
<td>Item Name:</td>
<td>
<input type="text" name="strname" size="20" value="<%=rsItem("name")%>"></td>
</tr>
<tr>
<td>Shop Price:</td>
<td><input type="text" name="strshop_selling" size="20" value="<%=rsItem("shop_selling")%>">
</td>
</tr>
<tr>
<td>Where do u get the item?</td>
<td>
<input type="text" name="strfound" size="20"value="<%=rsItem("found")%>">
</td>
</tr>
<tr>
<td>When examine it says:</td>
<td><input type="text" name="strexamine" size="20"value="<%=rsItem("examine")%>">
</td>
</tr>
<tr>
<td>High Alc.</td>
<td><input type="text" name="stralc_high" size="20"value="<%=rsItem("alc_high")%>">
</td>
</tr>
<tr>
<td>Type</td>
<td><input type="text" name="strtype" size="20"value="<%=rsItem("type")%>">
</td>
</tr>
<tr>
<td>Requirements?</td>
<td><input type="text" name="strrequirements" size="20"value="<%=rsItem("requirements")%>">
</td>
</tr>
<tr>
<td>Members only?</td>
<td><select size="1" name="strmember_only">
<% if rsItem("member_only")=False then%>
<option selected>No</option><option>Yes</option>
<% else %>
<option selected>Yes</option><option>No</option>
<% end if %></select>
</td>
</tr>
<tr>
<td>Rare</td>
<td><select size="1" name="strrare">
<% if rsItem("rare")=False then%>
<option selected>No</option><option>Yes</option>
<% else %>
<option selected>Yes</option><option>No</option>
<% end if %></select>
</td>
</tr>
<tr>
<td>Quest Item</td>
<td><select size="1" name="strquest">
<% if rsItem("quest")=False then%>
<option selected>No</option><option>Yes</option>
<% else %>
<option selected>Yes</option><option>No</option>
<% end if %></select>
</td>
</tr>
<tr>
<td>Tradeable</td>
<td><select size="1" name="strtradeable">
<% if rsItem("tradeable")=False then%>
<option selected>No</option><option>Yes</option>
<% else %>
<option selected>Yes</option><option>No</option>
<% end if %></select>
</td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="Update" name="submit"></td>
</tr>
</table>
</center>
</div>
</form>
</body>
</html>
<%
' Luk databaseforbindelse
Conn.Close
Set Conn = Nothing
%>
------------------------------------------------
Update_item_handler.asp
<html>
<head>
<title>RSFever</title>
<LINK href="style.css" type=text/css rel=stylesheet>
</head>
<body bgcolor="#000000" text="#FFFFFF" link="#008000" vlink="#008000" alink="#008000">
<center><font size="5">Item Added!</font></center>
<div align="center">
<center>
<table border="0">
<tr>
<td>Item Name:</td>
<td><%=Request.Form("strname")%></td>
</tr>
<tr>
<td>Shop Price</td>
<td><%=Request.Form("strshop_selling")%></td>
</tr>
<tr>
<td>Level</td>
<td><%=Request.Form("strfound")%></td>
</tr>
<tr>
<td>Members only?</td>
<td><%=Request.Form("strexamine")%></td>
</tr>
<tr>
<td>Hits</td>
<td><%=Request.Form("stralc_high")%></td>
</tr>
<tr>
<td>Loot (Common)</td>
<td><%=Request.Form("strtype")%></td>
</tr>
<tr>
<td>Loot (Rare)</td>
<td><%=Request.Form("strrequirements")%></td>
</tr>
<tr>
<td>Loot (Always)</td>
<td><%=Request.Form("strmember_only")%></td>
</tr>
<tr>
<td>When examine it says:</td>
<td><%=Request.Form("strrare")%></td>
</tr>
<tr>
<td>Agressive?</td>
<td><%=Request.Form("strquest")%></td>
</tr>
<tr>
<td>Type (Animal, Giant etc.)</td>
<td><%=Request.Form("strtradeable")%></td>
</tr>
</table>
</center>
</div>
</body>
</html>
<%
response.buffer = true
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("cgi-bin/itemsandmonsters.mdb")
Conn.Open DSN
strSQL = "Update tbl_Items set "
strSQL = strSQL & "[name]= Request.Form("strname") & "', "
strSQL = strSQL & "shop_selling= Request.Form("strshop_selling") & "', "
strSQL = strSQL & "found= Request.Form("strfound") & "', "
strSQL = strSQL & "examine= Request.Form("strexamine") & "', "
strSQL = strSQL & "alc_high= Request.Form("stralc_high") & "', "
strSQL = strSQL & "type= Request.Form("strtype") & "', "
strSQL = strSQL & "requirements= Request.Form("strrequirements") & "', "
strSQL = strSQL & "member_only= Request.Form("strmember_only") & ", "
strSQL = strSQL & "rare= Request.Form("strrare") & ", "
strSQL = strSQL & "tradeable= Request.Form("strtradeable") & ", "
strSQL = strSQL & "quest= Request.Form("strquest") & ") "
Conn.Execute(strSQL)
Conn.Close
Set Conn = Nothing
%>
