Hi,

I had the same problem in C# (Axapta 3 using the COM Business 
Connector [AxCOM.dll]), and I found the following solution:

------------------------------------------
1. For every object you get from Axapta, set nulling and release it 
with Marshal.ReleaseComObject as this:

    if (Marshal.IsComObject(custTable))
        Marshal.ReleaseComObject(custTable);

    custTable = null;
------------------------------------------

------------------------------------------
2. After calling logoff, also you need to release the Axapta 
interface, then, call the CoFreeUnusedLibraries Win32 API.

    ax.Logoff();

    if (Marshal.IsComObject(ax))
        Marshal.ReleaseComObject(ax);

    ax = null;

    ApiWin32.CoFreeUnusedLibraries();
------------------------------------------

The last sentence release the AxCOM.dll library, and also, close 
definitely the opened session with Axapta.

------------------------------------------
Here the class ApiWin32:

class ApiWin32
{
        [DllImport("ole32.dll")]
        public static extern void CoFreeUnusedLibraries();
}
------------------------------------------

------------------------------------------
Solution for Visual Basic 6.0:

Assign nothing to every object and after logoff, call 
CoFreeUnusedLibraries declare as follows:

Public Declare Sub CoFreeUnusedLibraries Lib "ole32.dll" ()
------------------------------------------


    

Reply via email to