学院首页>网络编程>ASP>返回UPDATE SQL语句所影响的行数的方法

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

作者:未知 来源:- 添加时间:2006-5-21 10:26:17
 用如下方法可以直接得到影响的行数:

<%
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
%>
站内搜索