I read some of the other thread's about this topic, but it still dosn't work and I don't know why.
There is an exception: 'Microsoft.ACE.OLEDB.12.0'-Provider not registred on local machine. I already installed Database engine for Office 2007 and 2010.
Do you have any ideas?
OS: Win 7 Prof. 64 bit
static void Main(string[] args)
{
OleDbConnection connection = null;
DataTable Sheets = null;
String file = args[0];
String filePath = Path.GetDirectoryName(args[0]);
String connPath = "";
if(Path.GetExtension(file).Equals(".xls"))
connPath = "Provider=Microsoft.Jet.OleDb.4.0; Data Source=" + file + ";Extended Properties=Excel 8.0";
else
connPath = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + file + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=1\"";
try
{
connection = new OleDbConnection(connPath);
connection.Open();
Sheets = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
...
Found it. You Need to complile the Project for x86 CPU. Any CPU wonnt work.
Thanks