[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

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

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
futuremoose
Asked:
futuremoose
2 Solutions
 
Rory ArchibaldCommented:
FYI, both run identically for me (both error as they can't find Sheet1, not due to a provider problem).
0
 
Éric MoreauSenior .Net ConsultantCommented:
be sure that the project giving you the error is targeting the x86 platform (it seems to currently target the ANY cpu).
0
 
Jacques Bourgeois (James Burger)Commented:
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
 
futuremooseAuthor Commented:
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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