asp 删除指定记录程序代码
<%
数据库教程连接
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.jiaochengji.com/a.asp';</script>")
else
response.write("<script>alert('删除失败,服务器忙....');location='new.asp';</script>")
end if
end if
%>
使用方法
<a href="http://www.jiaochengji.com/?id=1">删除</a>
本站原创文章,转载注明来源www.jiaochengji.com
您可能感兴趣的文章:
asp 删除指定记录程序代码
php 删除记录同时删除图片文件的代码
ASP Cookies 教程
asp Provider 错误 '80004005'解决办法
ADO Recordset 对象
Global.asa文件的使用及Chat程序
MySQL多表更新与多表删除的实现方法
ASP Application对象教程
asp简介和五大内置对象
在ASP.NET中创建自定义配置节(翻译)