ado.net - Can't read from my Excel file using C# -


I have a Excel 2007 file called "my.xlsx" and a "state" sheet, and I have the following code < Using the / P>

  (OLDBConnectedCon = newOldboxquake (@ "provider = MicrosoftAEC.OlDD.12.0; data source = C: \ my.xlsx; extended property = 'excel 12.0 xml; HDR = No '")) {OleDbCommand CMD = New Oleadby Comand (" Select [from the States] ", Con); Con.Open (); OleDbDataReader Reader = CMD. Spare reader (); While (reader.Read ()) console. Wrightite (reader [0]); }  

It says that the Microsoft Office Access database engine object 'States' could not be found. Make sure the object is present and you type its name and path name correctly. ".

Can anyone help me know what's wrong with my code?

I know this can not be what you want to hear, but you are in the long line of people who have struggled to try to read excel files using oleb ... < / P>

I have a lot of luck using NPIO like C #:

(Recommended) to read Excel files For


Comments