谁能告诉我这样修改数据什么修改不了了呢?别的页面也是这么写的,够纳闷了!
时间:2011-09-29
来源:互联网
<!-- #include file="conn.asp" -->
<%
img_name=request.querystring("img_name")
if request.querystring("del")="删除" then
'删除表中扫描件的记录
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "select * from htyj where img_name='"&img_name&"'"
application.lock
rs.open sql,conn,1,3
if rs.recordcount =1 then
rs.Delete
else
response.write "<script>alert('记录有误无法删除!');history.back();</script>"
response.write "<script>window.close();</script>"
response.end
end if
rs.close
application.unlock
Set rs = nothing
'删除扫描件原件
path = "\my\htxt\pic\"
img_name_path = path & img_name
img_name_path = server.mappath(img_name_path)
Set fso = Server.CreateObject("Scripting.FileSystemObject")
If fso.FileExists(img_name_path) Then '判断文件是否存在!
fso.DeleteFile (img_name_path),true '此处需要服务器支持FSO删除权限!
end if
response.write "扫描件已删除!"
response.write "<script>alert('删除成功!');window.close();</script>"
end if
%>
<%if request.querystring("xg")="修改" or request.form("Submit")="确 定 提 交" then%>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>合同扫描件修改说明</title>
</head>
'这段代码为修改的代码
<%
set rs=server.CreateObject("ADODB.RecordSet")
sql="select * from htyj where img_name='"&img_name&"'"
rs.open sql,conn,1,3
if request.form("Submit")="确 定 提 交" then
rs("shuoming")=request.form("shuoming")
rs.update
rs.close
set rs=nothing
response.write "<script>alert('修改成功!');window.close();</script>"
end if
%>
<body>
<center>
<div>
<form name="form1" method="post" action="htyj_xg.asp">
<table>
<tr align="left"><td><%=img_name%></td></tr>
<tr align="left"><td>扫描件说明:</td></tr>
<tr>
<td><textarea name="shuoming" cols="50" rows="6" id="shuoming"><%=rs("shuoming")%></textarea></td>
</tr>
<tr align="center"><td><input name="Submit" type="submit" class="button" value="确 定 提 交" style="width=130px;height=30px;font-size=12px"></td></tr>
</table>
</form>
</div>
</center>
</body>
</html>
<%
end if
%>
<%
close.conn
set conn=nothing
%>
<%
img_name=request.querystring("img_name")
if request.querystring("del")="删除" then
'删除表中扫描件的记录
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "select * from htyj where img_name='"&img_name&"'"
application.lock
rs.open sql,conn,1,3
if rs.recordcount =1 then
rs.Delete
else
response.write "<script>alert('记录有误无法删除!');history.back();</script>"
response.write "<script>window.close();</script>"
response.end
end if
rs.close
application.unlock
Set rs = nothing
'删除扫描件原件
path = "\my\htxt\pic\"
img_name_path = path & img_name
img_name_path = server.mappath(img_name_path)
Set fso = Server.CreateObject("Scripting.FileSystemObject")
If fso.FileExists(img_name_path) Then '判断文件是否存在!
fso.DeleteFile (img_name_path),true '此处需要服务器支持FSO删除权限!
end if
response.write "扫描件已删除!"
response.write "<script>alert('删除成功!');window.close();</script>"
end if
%>
<%if request.querystring("xg")="修改" or request.form("Submit")="确 定 提 交" then%>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>合同扫描件修改说明</title>
</head>
'这段代码为修改的代码
<%
set rs=server.CreateObject("ADODB.RecordSet")
sql="select * from htyj where img_name='"&img_name&"'"
rs.open sql,conn,1,3
if request.form("Submit")="确 定 提 交" then
rs("shuoming")=request.form("shuoming")
rs.update
rs.close
set rs=nothing
response.write "<script>alert('修改成功!');window.close();</script>"
end if
%>
<body>
<center>
<div>
<form name="form1" method="post" action="htyj_xg.asp">
<table>
<tr align="left"><td><%=img_name%></td></tr>
<tr align="left"><td>扫描件说明:</td></tr>
<tr>
<td><textarea name="shuoming" cols="50" rows="6" id="shuoming"><%=rs("shuoming")%></textarea></td>
</tr>
<tr align="center"><td><input name="Submit" type="submit" class="button" value="确 定 提 交" style="width=130px;height=30px;font-size=12px"></td></tr>
</table>
</form>
</div>
</center>
</body>
</html>
<%
end if
%>
<%
close.conn
set conn=nothing
%>
作者: qjw9004 发布时间: 2011-09-29
你不觉得这样查询出记录集来再删除有点多此一举么?
直接:
HTML code
不就好了嘛@!
直接:
HTML code
' Set rs = Server.CreateObject("ADODB.Recordset") sql = "select * from htyj where img_name='"&img_name&"'" 'application.lock conn.exec(sql) 'if rs.recordcount =1 then 'rs.Delete
不就好了嘛@!
作者: qianjin036a 发布时间: 2011-09-30
OH!还写错了!
HTML code
HTML code
' Set rs = Server.CreateObject("ADODB.Recordset") sql = "delete from htyj where img_name='"&img_name&"'" 'application.lock conn.exec(sql) 'if rs.recordcount =1 then 'rs.Delete
作者: qianjin036a 发布时间: 2011-09-30
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28