Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

asp.net

Posted on 2013-02-04
10
Medium Priority
?
262 Views
Last Modified: 2013-02-12
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
Comment
Question by:Dinesh Kumar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 23

Expert Comment

by:Roopesh Reddy
ID: 38853957
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
 
LVL 6

Accepted Solution

by:
manch earned 1500 total points
ID: 38853959
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
 
LVL 19

Expert Comment

by:Rimvis
ID: 38853968
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Dinesh Kumar
ID: 38854124
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
 

Author Comment

by:Dinesh Kumar
ID: 38856145
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
 
LVL 23

Expert Comment

by:Roopesh Reddy
ID: 38856480
Hi,

I doubt whether it's installed properly!  Install the updates as well!!!
0
 

Author Comment

by:Dinesh Kumar
ID: 38857859
I checked it saving the file and then I can open it as well in Excel.
0
 
LVL 23

Expert Comment

by:Roopesh Reddy
ID: 38858193
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
 

Author Comment

by:Dinesh Kumar
ID: 38858872
I will check this out but FYI I am using .net framework 2.0
0
 

Author Closing Comment

by:Dinesh Kumar
ID: 38879591
I tried 64bit drivers on the server and for it oledb drivers were giving error so I switched to ACE.OLEDB drivers only.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question