COM disposal

  • Thread starter Thread starter JC
  • Start date Start date
J

JC

On the second pass through the obj I get this error. This is all running on
my machine. I used the framework wizard to trust the interop.mydll.dll
assembly, what am I missing, do I force a disposal of the obj or what?

An unhandled exception of type 'System.Security.SecurityException' occurred
in AutoBiller.exe

Additional information: Permission denied

Thanks,
jc
 
Hi JC:

You'll have to post some code to show us what you are doing.
Permission denied msgs happen for a number of different reasons,
sometimes indirectly related to trust and authorization.
 
..net consumer code
cMain myDll = new cMainClass();
int iSuccess = myDll.DoOrders();
string sErr = "";
if (iSuccess == 0)
sErr = myDll.ErrMsg;
int iClose = myDll.CloseMe();
if (iClose == 1)
return true;
else
{
myLog.WriteIt(myDll.ErrMsg);
return true;
}

vb 6 interfaces only 2 with 1 property for the error msg.

Public Function DoOrders() As Integer

LogIt "Starting Export to Unisys " & Now
If OpenSqlConnection() Then
If GetNewDP2Orders() Then
ProcessDP2Orders
UpdateStatus
DoOrders = 1
Else
DoOrders = 0
End If
Else
DoOrders = 0
End If
LogIt "Finished Exporting to Unisys " & Now

End Function

Public Function CloseMe() As Integer

On Error GoTo errClose
Set cn = Nothing
Set cn2 = Nothing
Set rs = Nothing
Set rs2 = Nothing
Set rs3 = Nothing
Set rsChk = Nothing
Set rsOrderData = Nothing
Set rsDetail = Nothing
CloseMe = 1
Exit Function

errClose:
sErrMessage = "CloseMe Error Number: " & Err.Number & " Desc: " &
Err.Description
CloseMe = 0
End Function

John
 
Back
Top