?
Solved

To insert data into Excel file from datatable using C# .Net

Posted on 2005-04-06
5
Medium Priority
?
943 Views
Last Modified: 2010-07-27
LAYER: Domain
CLASS: ViewStatisticsManager            
METHOD: WriteToCSV1
MESSAGE: An unknown exception occured in Domain. jp Access is denied.
STACKTRACE:
at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType)
   at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(Type objectType)
   at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(Type serverType)

This is the error and it is coming at line which looks like this:
 " objExcel = new Excel.ApplicationClass(); "

I hv MS Excel 11.0 Object Library(MS Office 2003) & OS : MS 2000 Prof.

My task is : To insert data into Excel file from datatable.

This is very urgent need....plzzzzzz reply to this as early as possible
waiting for reply....

Thanking u in anticipation......

0
Comment
Question by:ketanghole
  • 2
2 Comments
 
LVL 14

Expert Comment

by:Thandava Vallepalli
ID: 13724350


Alternate is create new excel file using C# code....

send that file path to  below query... the query will insert the data into the excel automatically without creating excel object...

===================================================================
INSERT INTO OPENROWSET ('Microsoft.Jet.OleDB.4.0', 'EXCEL 8.0;Database=f:\Book1.xls', Sheet1$ ) (C1, C2)
SELECT TITLE_ID, TITLE
FROM TITLES
===================================================================

run this query using   command.NonQueryExceute( ) metbod.....

itsvtk
0
 
LVL 14

Accepted Solution

by:
Thandava Vallepalli earned 500 total points
ID: 13724385
Running office applications from asp.net is not supported by MS, and this KB
article tries to explain why:


http://www.dotnet247.com/247reference/msgs/45/228115.aspx
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757

itsvtk

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question