473,394 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Exception from HRESULT : 0x800A03EC --Please help me to fix this error

I am trying to export data from Excel11.0 object to datatable using C#. I can't
properly open workbooks. Can anyone please help me to fix this error. I got the above error when i try to open the Workbooks.Open(___,____, ). I am Beginner So kindly help me.

Here is the code:
Expand|Select|Wrap|Line Numbers
  1.           String strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" +
  2.            "Data Source=" + strpath + ";" + "Extended Properties=Excel 8.0;";
  3.                 OleDbConnection objconn = new OleDbConnection(strConnection);
  4.  
  5.                 if (objconn.State == ConnectionState.Closed)
  6.                 {
  7.                     objconn.Open();
  8.                 }
  9.  
  10.                 Excel.Application app = new Excel.Application();
  11.             // In the bellow line i got this error.  
  12.                 Excel.Workbook lworkbook = app.Workbooks.Open(txtselect.Text, Type.Missing, true, Type.Missing, Type.Missing,
  13.     Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
  14.     Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
  15.  
  16.                 lworkbook = app.ActiveWorkbook;
  17.                 Excel.Sheets lsheets = lworkbook.Worksheets;
  18.                 Excel.Worksheet lworksheet =   (Excel.Worksheet)lsheets.get_Item(1);
  19.                 lworksheet.Name = "person12";
  20.  
  21.                 OleDbCommand cmd = new OleDbCommand();
  22.                 OleDbDataAdapter adp = new OleDbDataAdapter("select * from person12", objconn);
  23.  
  24.                 adp.Fill(dt);
  25.                 dataGridView1.DataSource = dt;
  26.                 objconn.Close();
Oct 3 '07 #1
0 1446

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Steven | last post by:
Hi there, I am trying to export a chart using the Excel11 object from C#. I can properly open workbooks and read cells, but calling Export() on the Chart object throws a COMException ...
0
by: e-lores | last post by:
I need to print an excel doc to PDF. I'm doing next until now 1.- First I print the file to PostScript format using 'Acrobat Distiller' printer Dim wbook As Excel.Workbook wbook =...
8
by: scorpion53061 | last post by:
Additional information: Exception from HRESULT: 0x800A03EC. This code produced this error. I am pretty sure I got this to run a while back and I was wondering if you all see anything I am doing...
2
by: Sai | last post by:
Hi, I have written a small tool for our internal purpose in VB.net. This tool reads data from logs and saves it in an excel file. This tool is working fine with MS Office 2000 but raising the...
0
by: rGh | last post by:
Hello, I am trying to create an Excel chart from C#. I am not a very experieced programmer, so my mistake could be very trivial. The code included is a very simple example. I just wanted to...
0
by: hne | last post by:
Hi friends, I have an application, written in C#, in which I am updating an Excel spreadsheet with data I pull from a sql database. When I try to select a cell in where I want to begin inserting my...
0
by: santu07 | last post by:
I am trying to export data from Excel11.0 object to datatable using C#. I can't properly open workbooks. Can anyone please help me to fix this error. I got the above error when i try to open the...
0
by: Stephen Plotnick | last post by:
I'm getting HRESULT: 0x800A03EC On this statement: cfDataBar = osheet.Range(RangeText).FormatConditions.AddDatabar with these values in RangeText:...
1
by: fadi980 | last post by:
Hi, I'm exporting a data set into excel file from an ASP.NET application (VS 2008). On my PC, i got everything working just fine. but on my client server i got the error ( Exception from HRESULT:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.