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

ASP
WSH实用讲座---第四讲 配置目录权限
ASP个人上手指南
正则表达式简介(1-3)
正则表达式简介(4)
正则表达式简介(5-8)
正则表达式简介(9-10)
正则表达式简介(11)
正则表达式简介(12)
正则表达式简介(13)
正则表达式简介(14)
索引和索引调整向导
Microsoft SQL Server 查询处理器的内部机制与结构(1)
Microsoft SQL Server 查询处理器的内部机制与结构(2)
Microsoft SQL Server 7.0数据库设置与数据结构
Microsoft SQL Server 7.0数据库的创建与管理
Microsoft SQLServer安装示例
Microsoft SQL Server 7.0安装问题(一)
Microsoft SQL Server 7.0安装问题(二)
Microsoft 脚本编码器(1) --- 概述
Microsoft 脚本编码器(2) --- 使用脚本编码器

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 59 ::
收藏到网摘: 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
%>