how to get connection string on aspx page from web.config file using mysql odbc driver?

settings in web.config
<connectionStrings>
    <add name="Connection" connectionString="Driver={MySQL ODBC 3.51 Driver};datasource=mySQL;database=;uid=;password=" providerName ="System.Data.Odbc"/>
   </connectionStrings>

Code in aspx.cs page to connect to web.config connection string
 string ConnStr = System.Configuration.ConfigurationManager.ConnectionStrings["Connection"].ToString() ;

I am getting this error message
ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'localhost' (10061)
ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL

help is greatly appreciated!
bschave2Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

silemoneCommented:
Here is a great site:  http://www.connectionstrings.com/

Pick the server you're using...most likely Sql Server 2005 and see how all the connect strings are built...
0
silemoneCommented:
are you using a mySql DB?
0
bschave2Author Commented:
yes, mysql driver to get to mysql db. the link above is for connection strings only. I have the connection string, but noo way to connect to the string on my asp page.
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

silemoneCommented:
found someone with a same problem:

"I discovered that the cause of the problem was my using ODBC driver instead of MySQL Connector; apparently my ISP does not support ODBC.  Also I was using

I rewrote the connection string in my web.config file and now my application works."

Regards,
0
bschave2Author Commented:
right, but I need the code to reference the connection string on my pages.
0
silemoneCommented:
pls explain because that's what this does:

 string ConnStr = System.Configuration.ConfigurationManager.ConnectionStrings["Connection"].ToString() ;

Maybe you post more code...what do yo mean by 'I need the code to reference the connection string on my pages'
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bschave2Author Commented:
the string was incorrect. it didn't support the string from the web.config file. correct code is


  OdbcConnection con = new OdbcConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Connection"].ToString());
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.