用如下方法可以直接得到影响的行数:
<%
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
%>
最新评论