Försöker göra så att medlemmar får minus i poäng om man tarbort gästboksinlägg man skrivit. Felet beror nog på att du inte har definierat konstanterma adLockOptimistic etc. Minus i poäng när man tar bort inlägg? [löst]
Får följande fel när jag kör sidan:
ADODB.Recordset fel '800a0bb9'
The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another.
Så här ser koden ut:
<%
strDSN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("gboken.mdb")
' #### BEGIN ## Delete all mails in users mailboxs ####
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.open strDSN
strSQL = "DELETE FROM gb WHERE ID = "&Request.QueryString("delete")
call Connect.execute(strSQL)
Connect.close
set Connect = Nothing
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("anvandare.mdb")&";pwd=haha"
Set RecSet = Server.CreateObject("ADODB.Recordset")
Addera = "Select * From anvandare WHERE ID = "&Session("id")"
RecSet.Open Addera, Connect, adOpenStatic, adLockOptimistic
RecSet("poang") = RecSet("poang")-2
RecSet.Update
RecSet.Close
Connect.close
Response.Redirect "gboken.asp"&"?tillid=" & Request.QueryString("tillid")&"&delete="& Request.QueryString("delete")
%>
Den fungerar om jag bara har med:
<%
strDSN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("gboken.mdb")
' #### BEGIN ## Delete all mails in users mailboxs ####
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.open strDSN
strSQL = "DELETE FROM gb WHERE ID = "&Request.QueryString("delete")
call Connect.execute(strSQL)
Connect.close
set Connect = Nothing
Response.Redirect "gboken.asp"&"?tillid=" & Request.QueryString("tillid")&"&delete="& Request.QueryString("delete")
%>
...men jag vill minska poängen i databasen om man tar bort ett inlägg.Sv: Minus i poäng när man tar bort inlägg?
Jag tycker dock att du har onödigt mycket kod.
<code>
strDSN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("gboken.mdb")
' #### BEGIN ## Delete all mails in users mailboxs ####
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.open strDSN
strSQL = "DELETE FROM gb WHERE ID = "&Request.QueryString("delete")
call Connect.execute(strSQL)
call Connect.execute("update anvandare set poang = poang - 2 where id = " & session("id"))
Connect.close
Response.Redirect "gboken.asp"&"?tillid=" & Request.QueryString("tillid")&"&delete="& Request.QueryString("delete")
%>
</code>