dynamically loadind the excel dll

Feb 21, 2013 at 10:09 AM
Hi,

I am using the excel data reader . But I need to load the dll dynamically and get data from locally saved excel file. Can any one tell how can i accomplish this? Currently I am using the below method.

Assembly assembly = Assembly.Load("Excel, Version=2.1.0.0, Culture=neutral, PublicKeyToken=93517dbe6a4012fa");
Type type = assembly.GetType("Excel.IExcelDataReader");
Object obj= Activator.CreateInstance(type); // throws error cannot create instance of interface..

here i need to set the property IsFirstRowAsColumnNames and get the result dataset. Please reply ASAP.
Developer
Feb 21, 2013 at 11:40 AM
I think this is a general C# question, you are trying to create an interface, not the concrete implementation of the interface.

For example, instead of IExcelDataReader, try ExcelDataReader (I think that is it).

More info at http://stackoverflow.com/questions/6611412/cannot-create-an-instance-of-the-abstract-class-or-interface
Feb 22, 2013 at 4:14 AM
Thanks :)