Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Component Services / December 2005

Tip: Looking for answers? Try searching our database.

Serviced Component, Excel and OleDbConnection.Open

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
josef@wainz.net - 23 Nov 2005 19:07 GMT
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?
josef@wainz.net - 01 Dec 2005 15:20 GMT
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+.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.