cancel
Showing results for 
Search instead for 
Did you mean: 

The server threw an exception (Interop.SAPbobsCOM)

Former Member
0 Kudos

Hi all, i have a problem with my plugin (works with user defined form), in the begining it works fine but after some time fails to work properly and gives an exception on the following line.

oRecordSet = (Recordset)vCompany.GetBusinessObject(BoObjectTypes.BoRecordset);

please advice what might be the problem?

code

try

{

oRecordSet = (Recordset)vCompany.GetBusinessObject(BoObjectTypes.BoRecordset);

}

catch (Exception theException)

{

vCompany.GetLastError(out Errcode, out ErrorMessage);

Console.WriteLine("{0},,,,",Errcode,ErrorMessage,theException.Message,theException.Source,theException.InnerException);

}

oCommand = oRecordSet.Command;

oCommand.Name="Stored_Procedure";

Accepted Solutions (0)

Answers (1)

Answers (1)

FOA
Advisor
Advisor
0 Kudos

Hi Oleksiy,

Must likely you will have to release the Recordset or other Metadata objects that might exist in your process.

Example:

'System.Runtime.InteropServices.Marshal.ReleaseComObject(oRecordset)

'oRecordset = Nothing

or

oRecordset = Nothing

GC.Collect()

GC.WaitForPendingFinalizers()

This should be the problem.

Best regards,

Felipe