|
-
Sep 18th, 2003, 04:38 PM
#1
Thread Starter
Lively Member
Dispose Connection inside Class
I am long time vb hacker new to .net
Using vb.net I have the following code.
*******************************
Public Function GetData() As clsData
Dim rs As New ADODB.Recordset()
Dim colTemp As New clsDatas()
Do some work here...
rs.Close()
rs = nothing
***********************************
When I upgrade my project into vb.net I get the following message from .Net
'UPGRADE_NOTE: Object rs may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1029"'
I understand that GC will take care of itself in its own time.
However, lets say I want to dispose of the recordset within this function.
I dont know the proper way to do this.
I have seen a post that says to do the following;
Implement IDisposable
Public Overridable Overloads Sub Dispose() Implements IDisposable.Dispose
'\\ Do your cleaning up here....
End Sub
how do I call the Dispose method from within the above GetData function.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|