服务器软件:
windwos 2003 server ,sql server 2000我用vb6.0写了一个com,然后用asp调用,有时候用几小时com就停止了,有时候能用好几天没问题,出问题后我只要在com里面重新启动一下它又能正常使用了,另外在事件监视器中发现有下列错误,请各位高手指点一下怎样解决。The VB Application identified by the event source
logged this Application KangDa: Thread ID:3144
,Logged:Msgbox:,运行时错误'91'未设置对象变量或 With Block变量
windwos 2003 server ,sql server 2000我用vb6.0写了一个com,然后用asp调用,有时候用几小时com就停止了,有时候能用好几天没问题,出问题后我只要在com里面重新启动一下它又能正常使用了,另外在事件监视器中发现有下列错误,请各位高手指点一下怎样解决。The VB Application identified by the event source
logged this Application KangDa: Thread ID:3144
,Logged:Msgbox:,运行时错误'91'未设置对象变量或 With Block变量
Class1:Option Explicit
Private ObjectContext As COMSVCSLib.ObjectContext
Private TmpRs As ADODB.Recordset
Private Retmsg As String
Private ConnSql As StringPrivate Sub Class_Initialize()
Call InitConnection
Set TmpRs = New ADODB.Recordset
End SubPrivate Sub Class_Terminate()
Set TmpRs = Nothing
Set ObjectContext = Nothing
Call CloseConnection
End Sub
Public Function GetDeptInfo(ByRef pRetmsg As Variant) As Variant
On Error GoTo ErrDo
ConnSql = "Exec int_GetDeptInfo"
Set ObjectContext = GetObjectContext()
Set TmpRs = GetExecRsRpc(ConnSql, Retmsg)
If Retmsg = "" And Not TmpRs Is Nothing Then
Set GetDeptInfo = TmpRs
If Not ObjectContext Is Nothing Then ObjectContext.SetComplete
Else
Set GetDeptInfo = Nothing
If Not ObjectContext Is Nothing Then ObjectContext.SetAbort
End If
pRetmsg = Retmsg
Set TmpRs = Nothing
Set ObjectContext = Nothing
Exit Function
ErrDo:
pRetmsg = Err.Description
Set GetDeptInfo = Nothing
If Not ObjectContext Is Nothing Then ObjectContext.SetAbort
Set TmpRs = Nothing
Set ObjectContext = Nothing
Exit Function
End Function
Class2:
Option Explicit
Private ObjectContext As COMSVCSLib.ObjectContext
Private TmpRs As ADODB.Recordset
Private Retmsg As String
Private ConnSql As String'Class init
Private Sub Class_Initialize()
Set TmpRs = New ADODB.Recordset
Call InitConnection
End Sub'Class repose
Private Sub Class_Terminate()
Set TmpRs = Nothing
Set ObjectContext = Nothing
Call CloseConnection
End Sub'Common sql procedure
Private Sub ExecSQL(ByVal SqlStr As String, ByRef pMsg As Variant)
On Error GoTo ErrDo
Set ObjectContext = GetObjectContext()
Call ExecRsRpc(SqlStr, Retmsg)
If Retmsg = "" Then
If Not ObjectContext Is Nothing Then ObjectContext.SetComplete
Else
If Not ObjectContext Is Nothing Then ObjectContext.SetAbort
End If
pMsg = Retmsg
Set ObjectContext = Nothing
Exit Sub
ErrDo:
pMsg = Err.Description
If Not ObjectContext Is Nothing Then ObjectContext.SetAbort
Set ObjectContext = Nothing
Exit Sub
End Sub