Serviced Component, Excel and OleDbConnection.Open

  • Thread starter Thread starter josef
  • Start date Start date
J

josef

I'm using the OleDbConnection object to retrieve the contents of an
Excel Worksheet as a DataSet. This works fine when testing the
MyExcel.GetMonthly() method call.

When I call MyExcel.GetMonthly() from a Serviced Component, it bombs.

Code snippet:

OleDbConnection cn = new OleDbConnection(CnString);
cn.Open(); <-- Error occurs here

In an effort to isolate the problem I created a new class and called
MyExcel.GetMonthly() from it. Without ServicedComponent inheritence it
works fine. With ServicedComponent inheritence it crashes with:

A condition has occurred that indicates this COM+ application is in
an unstable state or is
not functioning correctly. Assertion Failure: !m_punk

Server Application ID: {6E4E5709-D807-46DD-819E-2B3D150FC547}
Server Application Instance ID:
{C73018C7-1BB0-4DB2-A9DB-4D9E22521507}
Server Application Name: MSRBLL
The serious nature of this error has caused the process to
terminate.
COM+ Services Internals Information:
File: d:\qxp_slp\com\com1x\src\comsvcs\jit\jit.cpp, Line: 858
Comsvcs.dll file version: ENU 2001.12.4414.258 shp

Any thoughts?
 
Guess I'll answer my own post :)

To ways to solve this problem:
1.) Put the assembly in the GAC
2.) Put the class that works directly with Excel in it's own
Class Library project. It doesn't need to inherit from
ServicedComponent,
only the rest of the Data Acess Layer needed COM+.
 
Back
Top