Data source name not found and no default driver specified
Asked Answered
A

2

0

The Error

ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

The Story

I've written a page outside of Visual Web Developer 2010 that uses a SqlDataSource object along with a FormView object that works perfect. Building upon those awesome skills I obtained I started to build a project within Visual Web Developer, this time creating an Empty Web Application and went along my happy way building my new site. I used the same techniques and almost the same code as before - just pointing to a different table but I was met with the aforementioned error message.

The Confusing part

Here's the puzzling part - if I take my page I wrote outside of Visual Web Developer, again - it works perfect - no complaints, and add it as a page to the project I've built it now presents the same error message and I have no idea why.

The Tests Completed

I've backed off of targeting .NET 4.0 framework and went to 2.0 as I am not using any specific 4.0 controls or methods at this time. I've taken my page that originally gave me issue and recreated it outside of a Visual Web Developer project and instead as a stand alone page and the exact same code - copy, cut, paste - works perfect!

The Solution...

At this point I'm left puzzled and mouth agape. Any help is appreciated why building a project in Visual Web Developer would cause anything different.

Aretha answered 20/7, 2010 at 20:20 Comment(0)
A
0

I should learn to read the answers to my own questions I posted no more than 2 weeks ago.

MySQL ODBC fails in C# .NET project but not runtime compiled code

Updating the connectionString to

DRIVER={MySQL ODBC 5.1 Driver};

instead of

DRIVER={MySQL ODBC 3. Driver};

seems to have corrected the issue once I fixed a stupid SQL Insert Statement issue.

Thanks for the help mwalker.

Aretha answered 21/7, 2010 at 15:4 Comment(0)
D
0

If you're running (e.g. debugging) your project within Visual Web Developer / Visual Studio / etc, it's likely running using the embedded web server. The embedded web server puts itself in a "sandbox" so it won't inherit any of the attributes set in the toplevel application / web site.

Where do you configure the data source name for your SQL connection? In the top level web site? In a parent application?

Does it work if you change the project properties to target local IIS instead of running on the embedded web server?

If so, you'll just have to move the connection string to the local web.config file, so that your new application can find it.

Discant answered 21/7, 2010 at 0:0 Comment(1)
I've tried to put the connectionString into the Web.Config file as many posts I've found recommend. When I attempt to run the project I receive an error that the ConnectionStrings returned is empty and/or not valid. The connectionString itself that I'm using now is simply entered directly into the SqlDataSource object in the code on the page. I've moved the page to run in the local IIS and no changes. Still perplexed.Aretha
A
0

I should learn to read the answers to my own questions I posted no more than 2 weeks ago.

MySQL ODBC fails in C# .NET project but not runtime compiled code

Updating the connectionString to

DRIVER={MySQL ODBC 5.1 Driver};

instead of

DRIVER={MySQL ODBC 3. Driver};

seems to have corrected the issue once I fixed a stupid SQL Insert Statement issue.

Thanks for the help mwalker.

Aretha answered 21/7, 2010 at 15:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.