删除功能不知道怎么用?

Marrylily 2008-06-12 10:41:02
<%
on error resume next
set rst=server.CreateObject("ADODB.recordset")

if request.querystring("act")="del" then
id=rst("u_id")
conn.begintrans
rst1.open "select * from users where u_id="&id,conn,1,3
rst.delete
rst.close
if err.number<>0 then
connrollbacktrans
response.write "删除失败!"
response.write err.description
else
conn.committrans
response.write "删除成功!"
end if
end if

%>
...全文
89 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
Marrylily 2008-06-12
  • 打赏
  • 举报
回复
不是这个问题,我已经改过了,还是不行啊
Sky_Wuhan 2008-06-12
  • 打赏
  • 举报
回复
rst1.open "select * from users where u_id="&id,conn,1,3
写错了吧,rst1改成rst试试.
Marrylily 2008-06-12
  • 打赏
  • 举报
回复
以上方法都不行?为什么?
sportboy2008 2008-06-12
  • 打赏
  • 举报
回复
ding!!!
gbfxixi 2008-06-12
  • 打赏
  • 举报
回复
<%
on error resume next
set rst=server.CreateObject("ADODB.recordset")

if request.querystring("act")="del" then
id=rst("u_id")
conn.begintrans
rst1.open "select * from users where u_id="&id,conn,1,3
...
%>
不是很明白。。。
以下这个,你看看可行。。
<%
on error resume next
set rst=server.CreateObject("ADODB.recordset")
if request.querystring("act")="del" then
id=rst("u_id")
conn.begintrans
Sql="select * from users where u_id="&id
rst.openSql,conn,1,1
Sql="delete from users where u_id="&id
conn.execute(Sql)
...
%>
Marrylily 2008-06-12
  • 打赏
  • 举报
回复
这种方法我试过了,可是不行啊!
puzhihang 2008-06-12
  • 打赏
  • 举报
回复
给你一段常使用的删除程序
<%
id=request("idx")
'--------------------------------------------
Set rp=Server.CreateObject( "ADODB.Recordset" )
str3="select * from 102_table where id="&id&""
rp.open str3,conn,1,3
if not rp.eof then
'清空数表中的数据
If trim(rp("c_001"))<>"" Then
c_001=trim(rp("c_001"))
spurl="../006_upfile/image/"&c_001
'删除文件
Call DoDelFile(spurl)
end if
'删除此记录
rp.delete
End If
rp.update()
%>
neo_yoho 2008-06-12
  • 打赏
  • 举报
回复
rst1.open "select * from users where u_id="&id,conn,1,3
是rst

删除
conn.execute "delete from users where u_id="&id
conn.close
conn=nothing
jhwcd 2008-06-12
  • 打赏
  • 举报
回复
sql="delete users where u_id="&id
conn.execute (sql)
Marrylily 2008-06-12
  • 打赏
  • 举报
回复
页面总是显示那条SQL删除语句有问题。请问一下各位精英,若要删除数据库里的东西,有几种方法?它们应该怎么写呢?

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧