VB Express 2008 - Dispose of ADODB.Recordset

L

Laurie

Hi,

I've used the VB Express upgrade feature to transform code from VB6 to
VB Express 2008

Part of my original code included:

<Code>
Dim RS As New ADODB.Recordset
Set RS = Nothing
RS.Open("SELECT DISTINCT GENUS FROM Plants ORDER by GENUS;", ogAccess)
</Code>

The translated code included:
<Code>
'UPGRADE_NOTE: Object RS may not be destroyed until it is garbage
collected. Click for more:
'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"'

RS= Nothing
</Code>

The referenced help indicates that I should Dispose of the RS, but RS
doesn't have a Dispose method.

What is the correct code to destroy the RS object?


Regards,


Laurie
 
T

Tom Shelton

Hi,

I've used the VB Express upgrade feature to transform code from VB6 to
VB Express 2008

Part of my original code included:

<Code>
  Dim RS As New ADODB.Recordset
  Set RS = Nothing
  RS.Open("SELECT DISTINCT GENUS FROM Plants ORDER by GENUS;", ogAccess)
</Code>

The translated code included:
<Code>
'UPGRADE_NOTE: Object RS may not be destroyed until it is garbage
collected. Click for more:
'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"'

RS= Nothing
</Code>

The referenced help indicates that I should Dispose of the RS, but RS
doesn't have a Dispose method.

What is the correct code to destroy the RS object?

Regards,

Laurie

Since it's a com object, I would probably call
Marshall.ReleaseComObject when your done...
 
T

Tom Shelton

Since it's a com object, I would probably call
Marshall.ReleaseComObject when your done...

Further, if you have time - I would probably consider moving away
form the old ado stuff and migrate to ADO.NET.
 
L

Laurie

Tom said:
Further, if you have time - I would probably consider moving away
form the old ado stuff and migrate to ADO.NET.

Hi Tom,

Thanks. "Marshall" does not seem to be available. Do I have to add an
"Imports" item to access it?


Presuming it's part of VB Express I will make time for ADO.NET as I wish
to learn the optimum ways.

I did a 3 day intro course with VB.NET, but the trainer was near the
limit of her knowledge once you got beyond the simplistic course content.

Could you point me to a starting location to use VB.NET


Regards,


Laurie Comerford
 
T

Tom Shelton

Hi Tom,

Thanks. "Marshall" does not seem to be available. Do I have to add an
"Imports" item to access it?

Imports System.Runtime.InteropServices
Presuming it's part of VB Express I will make time for ADO.NET as I wish
to learn the optimum ways.

Well, I noticed your post in the other group. I think you said you needed to
work with 64-bit code. I could be wrong, since I haven't used the old ADO
stuff for a LONG time - but, does it even work in 64-bit mode? I'm betting
that you will have to compile your code to target 32-bit to get it to work on
a 64-bit system.
 
N

Nobody

Laurie said:
I did a 3 day intro course with VB.NET, but the trainer was near the limit
of her knowledge once you got beyond the simplistic course content.

F2 is your friend...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top