Tilføj/ret i databasen
Har denne ASP side hvor jeg henter oplysninger fra en database. Fint nok, men jeg vil godt have mulighed for at rette og tilføje i databasen.<%
' SQL forespørgsel
strSQL = "Select * from StoreRoom where Sparepart_ID = " & request.querystring("sp_id")
Set rs = Conn.Execute(strSQL)
Do until rs.eof
Response.write "<td> <b>" & " " & rs("BRAND_ID") & "</td><td>" & rs("TYPE_ID") & "</td><td>" & rs("Amount") & "</td></b>"
Response.write "<td align=""center""><input type=image src=plus.jpg"
Response.write " onClick=""location.href='modify.asp?sp_id=" & request.querystring("sp_id") & "&sr_id=" & rs("sr_id") & "&add=1'"">"
Response.write "</td><td align=""center""><input type=image src=minus.jpg"
Response.write " onClick=""location.href='modify.asp?sp_id=" & request.querystring("sp_id") & "&sr_id=" & rs("sr_id") & "&minus=1'""><br></td>"
%>
<tr>
<%
rs.movenext
loop
%>
</tr>
</table>
<%
if request.querystring("add") = "1" then
SQL = "Update DISTINCTROW StoreRoom SET Amount = Amount+1 where sr_id = " & request.querystring("sr_id")
Conn.Execute(SQL)
response.redirect "modify.asp?sp_id=" & request.querystring("sp_id")
end if
if request.querystring("minus") = "1" then
SQL = "Update DISTINCTROW StoreRoom SET Amount = Amount-1 where sr_id = " & request.querystring("sr_id")
Conn.Execute(SQL)
response.redirect "modify.asp?sp_id=" & request.querystring("sp_id")
end if
conn.close
set conn = nothing
%>
Hvordan?
