用如下方法可以直接得到影响的行数:
1
2dim conn
3dim sql
4dim lngrecs
5
6sql="update table1 set field1='good'"
7set conn=server.createobject("adodb.connection")
8conn.open dsn
9conn.execute sql,lngrecs
10conn.close:set conn=nothing
11
12response.write lngrecs
用存储过程也有同样的功能:
1
2dim cmd
3dim lngrecs
4dim sql
5
6sql="update table1 set field1='good'"
7set cmd=server.createobject("adodb.command")
8with cmd
9.activeconnection=dsn
10.commandtype=adcmdstoredproc
11.commandtext=sql
12.execute lngrecs,,adexecutenorecords
13end with
14set cmd.activeconnection.nothing
15set cmd=nothing
16
17response.write lngrecs