should I close connection?
- From: wolfing1@xxxxxxxxx
- Date: 30 Jun 2005 07:36:14 -0700
Hi all. I'm trying to fix a VB6 application that is returning
'Application error. The instruction at 0x7c8327f9 referenced memory at
0xffffffff' when it finishes (everything works fine, but when it's
supposed to end it returns this error).
I'm looking at the code for possible problems, and I found this that
looks suspicious:
Public Function ADId(DBConnectStr As String, ReportId As Integer) As
ADODB.Recordset
Dim ObjConn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strSQL As String
strSQL = "Select * from tablet1 where Report_Id=" & CStr(ReportId) &
""
ObjConn.Open DBConnectStr
rs.Open strSQL, ObjConn, adOpenKeyset, adLockReadOnly
Set AllDistributionMethodbyReportId = rs
end function
So basically, it returns a recordset, but the application that calls
the function then closes the returning recordset and sets it to
nothing, but what about the connection? Does it get automatically
closed? Should I close it in the application before closing the
recordset? Could this be the problem?
.
- Follow-Ups:
- Re: should I close connection?
- From: Stephen Howe
- Re: should I close connection?
- Prev by Date: Re: Cached ADO
- Next by Date: Re: multi recordset error?
- Previous by thread: multi recordset error?
- Next by thread: Re: should I close connection?
- Index(es):