views:

20

answers:

1

I have a project in which I'm accessing a MySql database on my web server via MySql ODBC driver 3.51. So far I've stuck to writing the ASP.NET C# code for this web app in notepad and just using runtime compiles on the server side to operate everything. So instead of using something like:

<%@ Page Title="Add Order" Language="C#" MasterPageFile="~/main_layout.Master" AutoEventWireup="true" CodeBehind="order_add.aspx.cs" Inherits="Orders.order_add" %>

I've been using:

<script language="c#" runat="server" src="cs/orders.cs"></script>

within the header of the page to load the C# code to access the database. That was quickly becoming a bear to manage and I see numerous advantages to creating my web application the way Microsoft and God intended.

But when I take the exact same code and pull it from my previous work and put it into Visual Studio 2010 (Express) I get a connection error.

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

Presumably it can't find the connection to the database. I've checked the connection string, stored in the Web.Config file, to validate that the information is correct and it's spot on. What is the difference in what I'm doing here that is causing my failure?

Other notes: this is the MySql 3.51 ODBC Driver on Windows 7 64bit, Microsoft Visual Web Developer 2010 Express

A: 

Upgrading to MySql ODBC 5.1 Driver seems to have fixed the issue. Just installed the latest driver and updated the connection string from 3.51 to 5.1 and viola, it worked. Odd why - but oh well. Mine is not to question why...

Jeff