当前位置: 首页 > 图文教程 > 网络编程 > ASP > 返回UPDATE SQL语句所影响的行数的方法

ASP
ASP设计常见问题及解答精要-1
ASP设计常见问题及解答精要-2
ASP设计常见问题及解答精要-3
ASP设计常见问题及解答精要-4
asp学习入门经验谈
如何才能成为一名真正的Web程序员
手把手教你在ASP中使用SQL语句
ASP与数据库应用(给初学者)
亲密接触ASP.Net(1)
亲密接触ASP.Net(2)
亲密接触ASP.Net(3)
亲密接触ASP.Net(4)
亲密接触ASP.Net(5)
.Net边学边讲(一)
.Net边学边讲(二)
.Net边学边讲(三)
NET移植案例学习:建造Web站点(1)
NET移植案例学习:建造Web站点(2)
ASP 3.0高级编程(四十)
深入研究Application和Session对象(1)

ASP 中的 返回UPDATE SQL语句所影响的行数的方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 82 ::
收藏到网摘: n/a

  用如下方法可以直接得到影响的行数:

<%
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
%>