Click here to Skip to main content
16,021,181 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI,
THIS IS MY web config file
HTML
<connectionstrings>
   
  <add name="connMySql" connectionstring="Driver={MySQL ODBC 3.51 Driver};server=kdemo.db.88443916.hostedresource.com;User Id=kdemo;database=kdemo;password=;Option=0;" />

    
  </connectionstrings>

this is the code file
C#
// Try to connect to the database based on our stored connection string.
string conString = WebConfigurationManager.ConnectionStrings["connMySql"].ConnectionString;
               using (OdbcConnection con = new OdbcConnection(conString))
               {
                   con.Open();
                   // We are now connected. Now we can use OdbcCommand objects
                   // to actually accomplish things.
               }

when opening connection it is giving
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

any help please
Posted
Updated 20-Feb-12 2:15am
v3
Comments
Varun Sareen 20-Feb-12 7:49am    
Database id is wrong in the connection string. Please post your connection string :)

You need to check the configuration string in your web.config - it doesn't match the environment you are in.

We can help no more: we have no idea what connection string your should need - you maybe able to get it by setting up a data connection in VS and looking at the ConectionString property for the connection in the properties pane.
 
Share this answer
 
Driver={MySQL ODBC 3.51} change driver information based on the installation
and the issue solved.
 
Share this answer
 
There is a MySql connector for .net. waht it does it that it will install the required drivers so that the mysql can be used via ODBC. so

1. Check you have the drivers installed in machine.
2. If yes then check if the version is outdated and causing the problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900