SqlBulkCopy to upload Excel

.net c# sqlbulkcopy

Question

If Im using SqlBulkCopy in .net 4.0 on a sql 2008 R2 database to upload excel data to the database, do I actually need Excel on the box hosting the site for this to work?

The reason I ask is I have a site up and running with this, and the hosting box has excel. The customer wants the site moved to a new box, this one doesnt have Excel and that bulk copy doesnt work. Other than the lack of excel there is no other difference.

thanks

Accepted Answer

If you are using the Microsoft Excel Object Library (COM Interop) to interface with Excel from .Net 4, then yes you need Excel installed as that is interfacing with the Excel object library.

What are your project references in C#?

Anything link to office automatiion would need taht part of office that is being automated. Also, if .Net 4 that objects may be referenced with the dynamic keyword.

Hard to tell exactly without knowing the project, references, and relevant code.

However, there are several third party libraries that allow interaction with Excel without having Excel installed. So, if you need to work without Excel, investigate using those.



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why