蓝森林首页 | 返回主页 | 本站地图 | 站内搜索 | 联系信箱 |
 您目前的位置:首页 > 自由软件 > 技术交流 > 应用编程


    

蓝森林 http://www.lslnet.com 2006年8月25日 8:28

[asp]有什么可以判断insert动作已经完成

例如,在asp中先执行插入再执行删除,有没有办法去判断插入动作已经完成呢?
set Con =server.CreateObject ("adodb.connection")
Con.cursorlocation = 3
Con.Open("Driver={sql server};..")
dd_bf="insert a_test select * from  a"
con.execute(dd_bf)
del_a="delete a"
con.execute(a)

先读出a_test的总条数,插入后再读一次,然后判断了再执行删除!太麻烦了吧
不用存储过程的话可以直接判断吗?




插入后再删除?那还插入干吗啊?
没有报错就插入成功了,插入后立刻转向别的页,避免重复插入

intCountNumber = objConnection.Errors.Count
楼主使用的是“connection”对象,此对象有errors集合,此集合有count属性,若此属性值大于零,说明出错,请使用connection对象的三个方法:1、BeginTrans 2、commitTrans 3、RollBackTrans

con.execute会有返回信息。

con.execute dd_bf,lngAffected,1+128

if lngAffected = 1 then
     '插入成功
     con.execute a,,1+128
else
     '插入失败
end if




Copyright © 1999-2000 LSLNET.COM. All rights reserved. 蓝森林网站 版权所有。 E-mail : webmaster@lslnet.com