HighTechTalks DotNet Forums  

Serviced Component, Excel and OleDbConnection.Open

Dotnet Framework (Component Services) microsoft.public.dotnet.framework.component_services


Discuss Serviced Component, Excel and OleDbConnection.Open in the Dotnet Framework (Component Services) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default Serviced Component, Excel and OleDbConnection.Open - 11-23-2005 , 02:07 PM






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
when it tries to open the connection with "Object reference not set to
an instance of an object"

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 worked until I added
the [ Transaction(TransactionOption.Required)] attribute, this threw
the error: "The ServicedComponent being invoked is not correctly
configured (use regsvcs to re-register)"

Any thoughts?


Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: Serviced Component, Excel and OleDbConnection.Open - 12-01-2005 , 10:20 AM






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+.


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.