webForumDet fria alternativet
Logga in / Bli medlem

problem med delete

Databaser & SQL

1 svar · 180 visningar · startad av WebbisNet

Medlem sedan feb. 20032 027 inlägg
Trådstart#1

Vad är det för fel med den här delete-satsen?

<!-- #include file="../Include/inc/conn.inc" -->

<%
Dim RS
Dim SQL
Dim Conn

set conn = Server.CreateObject("ADODB.Connection")

SQL = "DELETE FROM kontakt WHERE ID =" & Request.Querystring("ID") & ""

conn.Open connstr
Set RS = conn.Execute(SQL)

RS.Delete

RS.Close 
conn.Close

response.redirect "mail_read.asp"
%>

Medlem sedan dec. 200012 464 inlägg
#2

Du har en del onödig kod

<!-- #include file="../Include/inc/conn.inc" -->

<%
Dim SQL
Dim Conn

set conn = Server.CreateObject("ADODB.Connection")

SQL = "DELETE FROM kontakt WHERE ID =" & Request.Querystring("ID") 

conn.Open connstr
conn.Execute  sql
conn.Close

response.redirect "mail_read.asp"
%>
246 ms totalt · 4 externa anrop · v20260731065814-full.51f67c91
123 ms — deklarationer (db)
0 ms — hämta statistik (cache)
119 ms — hämta tråd, inlägg och bilagor (db)
124 ms — ändringar (db)