asp对数据库的操作中判断连接对象的状态

在asp数据库操作程序中经常要关闭记录集对象清除对象,如果重复进行清除操作就会出现错误,一个解决的方法是先对对象的状态进行判断然后在进行相应的操作。如有问题竟联系我([email protected])或到本站获取最新信息(www.miplat.com)。

sub closers(crs)
if Not crs Is Nothing Then '对象未清除
if (crs.state and 1)=1 then
crs.close
end if
set crs=nothing
end if
end sub
sub endconnection(Econn)
if Not Econn is Nothing then
if (Econn.state and 1)=1 then
Econn.close
end if
set Econn=nothing
end if
end sub


原文链接: http://blog.csdn.net/vince6799/article/details/536382

你可能感兴趣的:(asp对数据库的操作中判断连接对象的状态)