返回UPDATE SQL語(yǔ)句所影響的行數(shù)的簡(jiǎn)單實(shí)現(xiàn)代碼
作者: 來源: 發(fā)布時(shí)間:2011-7-8 16:14:46 點(diǎn)擊:
下面提供給大家分享的是關(guān)于返回UPDATE SQL語(yǔ)句所影響的行數(shù)的方法,希望對(duì)大家有幫助。
用如下方法可以直接得到影響的行數(shù):
<%
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
%>
用存儲(chǔ)過程也有同樣的功能:
<%
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
%>
上一篇:使用集合清除站內(nèi)Cookies的實(shí)例代碼分享 下一篇:
[收藏此文章]