• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

asp.net

1) Should Excel must be installed on the Server to use the following in asp.net

using Excel = Microsoft.Office.Interop.Excel;

if yes for what version should I go 2007 or 2010 or complete MS-Office?



2) Installing Excel will also help in sorting out the problem with the following code?

 if (fileExtension == ".xls")
                {
                    connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileLocation + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\"";
                }
                else if (fileExtension == ".xlsx")
                {
                    connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileLocation + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\"";
                }

the problem is "The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine" the server is 64bit. can you please also provide the solution for it? The server has Excel viewer only.

Thanks
Dinesh
0
Dinesh Kumar
Asked:
Dinesh Kumar
1 Solution
 
Roopesh ReddyIT AnalystCommented:
Hi,

Seems like, Excel should be installed! It can be 2007/2010. So, you can also check this link - http://stackoverflow.com/questions/11448197/how-to-use-microsoft-office-interop-excel-on-a-machine-without-installed-ms-offi

For your second issue, needs to be analyzed once the first issue is solved! Mostly it will be solved!

Hope it helps u...
0
 
manchCommented:
Answer to your queries :

1) Should Excel must be installed on the Server to use the following in asp.net

[Answer]
Yes, Excel will be required for it. You can have either of the MS-Office versions installed on your server and if suppose you have installed Office 2010 on your server; you have to take reference of the following dll library (to your code)

Microsoft.Office.Interop.Excel (Vesion 14.0.0.)


2) Installing Excel will also help in sorting out the problem with the following code?

[Answer]

The issue described in question occured basically due to the incompatibility of the Microsoft.Jet.OLEDB.4.0 driver in 64 bit OS.  If you are using Microsoft.Jet.OLEDB.4.0 driver in a 64 bit server, you have to force the application to build in in 32 bit mode; which causes other part of code to break.

Fortunately, now Microsoft has released a 64 bit compatible 2010 Office System Driver which can be used as replacement for the traditional Microsoft.Jet.OLEDB.4.0 driver. It works both in 32 bit as well as 64 bit servers. But this driver is in BETA.

You can download this driver from Microsoft Access Database Engine 2010 Redistributable.
0
 
RimvisCommented:
Hi  meetDinesh,

1) Short answer is yes, you have to install Excel to use interop. The slightly longer answer is that you shouldn't use Office automation on server-side applications.
http://support.microsoft.com/kb/257757

2) There is no Jet driver for 64bit systems. You could use it, but you'll have to switch entire ASP.NEW application to 32 bit mode
https://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/55cd5e11-49a9-4158-8b1f-7f2aa4ad2f07.mspx?mfr=true

But why are you switching connection string here? I think you can use ACE driver to read XLS files.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Dinesh KumarAuthor Commented:
Fine.

manch: I tried to install Microsoft Access Database Engine 2010 Redistributable http://www.microsoft.com/en-in/download/details.aspx?id=13255
but it says first you need to uninstall 32 bit version... ( I used AccessDatabaseEngine_x64.exe)

Rimvis: I will try your second solution.

roopeshreddy: Ok.

On server its IIS7.
0
 
Dinesh KumarAuthor Commented:
The client has installed the 2007 excel but without the serial key and told that its fully functional.

but I am finding the following error:

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.

it was coming before also when Excel 2007 was not installed.
0
 
Roopesh ReddyIT AnalystCommented:
Hi,

I doubt whether it's installed properly!  Install the updates as well!!!
0
 
Dinesh KumarAuthor Commented:
I checked it saving the file and then I can open it as well in Excel.
0
 
Roopesh ReddyIT AnalystCommented:
Hi,

Check this article on how insall Office Primary Interop - http://msdn.microsoft.com/en-us/library/kh3965hw(v=vs.100).aspx

Hope it helps u...
0
 
Dinesh KumarAuthor Commented:
I will check this out but FYI I am using .net framework 2.0
0
 
Dinesh KumarAuthor Commented:
I tried 64bit drivers on the server and for it oledb drivers were giving error so I switched to ACE.OLEDB drivers only.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now