Solved

Two identical(?) projects - one fails, one works

Posted on 2012-03-12
4
201 Views
Last Modified: 2012-03-12
I have attached two seemingly identical VB Express 2010 projects... they both have identical (copied and pasted) code for Button1 to read data from an Excel spreadsheet and display it in a DataGrid... very simple.

However, one project consistently gives me an OLEdb error as you can see in the screenshot (untitled.jpg) and the other works fine... on the same machine (Lenovo W500 laptop)

I have gone through the compilation options, resources, MyProject files, etc for both projects, and I can find no difference. For instance, I made sure the target framework for both was ".NET Framework 4 Client Profile".

I am really scratching my head as to why one works and the other does not... can you detect some difference and/or explain the OLEdb error in this context?
Excel-OLEdb-read-tests.zip
0
Comment
Question by:futuremoose
[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
4 Comments
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 37708728
FYI, both run identically for me (both error as they can't find Sheet1, not due to a provider problem).
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 250 total points
ID: 37708998
be sure that the project giving you the error is targeting the x86 platform (it seems to currently target the ANY cpu).
0
 
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 250 total points
ID: 37709149
The Jet Database Engine that is used to establish the connection is not recognized by 64-bits applications. You need to set the compilation to 32-bits, that is to x86 in order to work with the Jet, either to connect to Excel or to an Access database.
0
 

Author Closing Comment

by:futuremoose
ID: 37712313
Emoreau and JamesBurger,<br /><br />You were correct in that the x86 platform was being targeted in one project and not the other, although I'm not sure why. <br /><br />I had to do some digging around to figure out how to add "x86" to the list of target CPU's, since only "Any CPU" was listed as an option at first. Once I figured out how to add "x86" and selected it, the project worked. <br /><br />Thanks.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

691 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