ASP类的问题。(数据库的关闭)
<%
Class Ado
Private ConnString
Private DbConn
Public Property Get GetConnectionStr
GetConnectionStr = ConnString
End Property
Public Property Let SetConn(ConnStr)
ConnString = ConnStr
End Property
Public Property Get Connection
IF Not IsObject(DbConn) Then
Set DbConn = Server.CreateObject("Adodb.Connection")
DbConn.Open Me.GetConnectionStr
End IF
Set Connection = DbConn
End Property
Public Function ExecuteSql (Sql)
'on error resume next
Connection.BeginTrans
Connection.Execute Sql,ExecNum
if err.number <>0 then
Connection.RollbackTrans
'response.Write Err.Description&" <br>"&Sql
execsql= False
else
Connection.CommitTrans
'execsql=True
end if
ExecuteSql=ExecNum
End Function
End Class
%>
如果我用此类去执行某记录集操作。
Set A=New Ado
A.Connection="数据库连接"
Set Rs=A.Execute(Sql,1)
.....
Rs.Close
Set Rs=Nothing
Set A=Nothing
以上程序并没有一个DbConn.Close 的过程,
当我使用Set A=Nothing 后,会不会自动断开DbConn的链接呢?
还是需要在类里增加下面的代码?
相关问答:
我的網頁代碼為ASP語言,驗證方式為系統自帶的WINDOW驗證模式.
現在我如果要在ASP代碼中獲取當前的登入人 ......
<%
Sql="select top 8 * from NewsData where d_classid in (select classid from NewsClass where ParentID=16)"
Rs.Open Sql, conn, 1,1
Do Until Rs.Eof
......
现在这社会基本上不需要ASP程序员了,一面试,都要.NET或者PHP,JSP的,哎,,,,ASP这么不值钱吗,学习ASP是个错误吗
没啥错误 一句话:技多不压身
靠ASP都混不到饭吃了 晕 晕
我的意思是多学一门技术没啥错误 ......
请问为什么我这段代码可以显示已修改成功pic文件夹中的图片,但实际上文件夹中的文件名称还是好好的。望高手帮忙改改啊。
<%
Set fs = Server.CreateObject("Scripting.FileSystemObject")
S ......
IsSqlDataBase = 0 '主数据库类型(1=SQL,0=AC)
'===========================================================================
SqlDatabaseName = "ads365" '主数据库名
S ......