Recordset exception. What am I doing wrong?

Anonymous
01-24-2005, 02:55 PM
Here is some test code in my program that I used to hunt down an exception.

MapPoint.DataSet assignedMembers = oMap.DataSets.AddPushpinSet(
"Membership2" );
// Add 0 or more pushpins to the dataset
MapPoint.Recordset rs;
for ( int i = 0; i < 500 ; i++)
{
rs = assignedMembers.QueryAllRecords();
}

Regardless of how many pushpins are added to the dataset, there will always
be an unknown COM exception thrown when i = 201.

Is there something that needs to be done to dispose, reset, delete, release,
or reset the Recordset?

Help me Obe Wan Kenobe. You are my last hope.

--
Regards.
Mark K Vallevand
mark.vallevand@unisys.com

Anonymous
01-25-2005, 10:07 AM
Someone made this suggestion:

I think you either need to call ReleaseDispatch() between invocations of
QueryAllRecords() or create a "new" Recordset each time and delete when you're done.

I don't grok this. ReleaseDispatch() is on what object? I don't see it anywhere.

What do you mean by "new" and "delete" Recordset? QueryAllRecords() returns a Recordset. I assume that C# manages this object like others. I don't need to explicitly delete it.

I'm missing something obvious or fundamental.

Anonymous
01-25-2005, 11:55 AM
OK. This guy was talking C++. This is C#.

Has anyone ever called any of the query methods and gotten more than 200 recordsets?

I think there is a bug here.

Regards.
Mark K Vallevand
mark.vallevand@unisys.com

Anonymous
01-25-2005, 02:26 PM
OK. I found it. If you force garbage collection, the recordset objects get released and the COM interface is happy.

Added this code:
System.GC.Collect();

System.GC.WaitForPendingFinalizers();

 
Web mp2kmag.com
mapforums.com