指引网

当前位置: 主页 > 编程开发 > ASP >

asp 删除指定记录程序代码

来源:网络 作者:佚名 点击: 时间:2017-08-23 21:47
[摘要] 指引教程为您提供asp 删除指定记录程序代码等资源,欢迎您收藏本站,我们将为您提供最新的asp 删除指定记录程序代码资源
这是一款asp 删除指定记录程序代码哦,实例由点击连接到删除页面,并且执行删除,
<script>ec(2);</script>

<%
数据库教程连接
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

判断是否为登陆用户

if session("username")="" and session("userpwd")="" then
response.Redirect("login.html")
end if
dim sql,id

获取Id由地址栏传过来的值

id=html_encode(request.QueryString("id"))
 if id="" or not isnumeric(id) then
  response.Write("非法操作")
 else
  sql="delete * from new where id="&id
  call opendb()
  conn.execute(sql)
  if err=0 then
   response.write("<script>alert('删除成功');location='www.111cn.net/a.asp';</script>")
  else
   response.write("<script>alert('删除失败,服务器忙....');location='new.asp';</script>")
  end if
 end if
%>

使用方法
<a href="http://www.111cn.net/?id=1">删除</a>

本站原创文章,转载注明来源www.111cn.net

------分隔线----------------------------