Solved

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

Posted on 2012-03-12
4
196 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
4 Comments
 
LVL 85

Expert Comment

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

Accepted Solution

by:
Éric Moreau earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now