Michael Stephenson

keeping your feet on premise while your heads in the cloud
posts - 312 , comments - 350 , trackbacks - 11

My Links

News

View Michael Stephenson's profile on BizTalk Blog Doc View Michael Stephenson's profile on LinkedIn

Twitter












Archives

Post Categories

Image Galleries

BizTalk

Mates

Data Driven Unit Test - Excel DSN Error

Just a little quick one for myself....

When running some data driven unit tests we were getting the below error.

Unit Test Adapter threw exception: System.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.

The cause of this was that we had rebuild the machines and somehow when installing office the DSN for Excel hadnt been created.  On all of the other machines it had been setup fine but for some reason on my machine it hadnt been setup. 

The fix was to create a DSN called Excel Files pointing to excel drivers and then just rerun the unit tests.

As a reminder the test attributes for this were below:

[TestMethod][DeploymentItem(@"..\..\..\mappings.xlsx")]

[DataSource("System.Data.Odbc", "Dsn=Excel Files;dbq=|DataDirectory|\\spreadsheet.xlsx", "worksheet1$", DataAccessMethod.Sequential)]

Print | posted on Friday, November 12, 2010 2:50 PM |

Feedback

No comments posted yet.
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: