展会信息港展会大全

asp 删除指定记录程序代码
来源:互联网   发布日期:2016-03-01 11:16:32   浏览:1875次  

导读:这是一款asp教程 删除指定记录程序代码哦,实例由点击连接到删除页面,并且执行删除,<%数据库教程连接sub opendb()set rs=server.CreateObject(...

这是一款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.3lian.net/a.asp';</script>")

else

response.write("<script>alert('删除失败,服务器忙....');location='new.asp';</script>")

end if

end if

%>

使用方法

<a href="http://www.3lian.net/?id=1">删除</a>

赞助本站

人工智能实验室

相关热词: 开发 编程 android

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港