html5中文学习网

您的位置: 首页 > 网络编程 > ASP编程 » 正文

返回UPDATE SQL语句所影响的行数的方法_ASP教程_编程技术

[ ] 已经帮助:人解决问题
用如下方法可以直接得到影响的行数:

<%
dim conn
dim sql
dim lngrecs

sql="update table1 set field1='good'"
set conn=server.createobject("adodb.connection")
conn.open dsn
conn.execute sql,lngrecs
conn.close:set conn=nothing

response.write lngrecs
%>

用存储过程也有同样的功能:
<%
dim cmd
dim lngrecs
dim sql

sql="update table1 set field1='good'"
set cmd=server.createobject("adodb.command")
with cmd
.activeconnection=dsn
.commandtype=adcmdstoredproc
.commandtext=sql
.execute lngrecs,,adexecutenorecords
end with
set cmd.activeconnection.nothing
set cmd=nothing

response.write lngrecs
%>

hQGHTML5中文学习网 - HTML5先行者学习网
hQGHTML5中文学习网 - HTML5先行者学习网
(责任编辑:)
推荐书籍
推荐资讯
关于HTML5先行者 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助