<%
Database Tutorial Connections
Sub Opendb ()
Set Rs=server. CreateObject ("Adodb.recordset")
Set Conn=server. CreateObject ("Adodb.connection")
Conn.connectionstring= "Provider=Microsoft.Jet.OLEDB.4.0; Data source= "&server.mappath (" Datasource/hhinfo.mdb ")
Conn.Open
End Sub
Determine if the user is logged in
If session ("username") = "" and Session ("userpwd") = "" Then
Response. Redirect ("login.html")
End If
Dim sql,id
Gets the value that the ID passes over the address bar
Id=html_encode (Request. QueryString ("id"))
If id= "" or not IsNumeric (ID) Then
Response. Write ("Illegal operation")
Else
Sql= "Delete * from new where id=" &id
Call OPENDB ()
Conn.execute (SQL)
If Err=0 Then
Response.Write ("<script>alert (' delete success '); location= ' www.111cn.net/a.asp ';</script>")
Else
Response.Write (' <script>alert (' delete failed, server busy ... '); location= ' new.asp ';</script> ')
End If
End If
%>
How to use
<a href= "http://www.111cn.net/?id=1" > Delete </a>
Original site article, reprinted annotated Source Www.111cn.net