Click here to Skip to main content
15,922,894 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Please anyone can say how to connect mysql .net. I need connection string in web.config for connect mysql in asp.net c#.

I hoping for you...
Posted
Updated 7-May-13 7:09am
v2

Here is a sample I've used
XML
<add name="MySqlConnectionString" connectionString="server=127.0.0.1;User Id=root;password=bpdash;database=sample"
   providerName="MySql.Data.MySqlClient" />

before that you should have MySql .Net connector plugin installed in your system.
If you don't have get it and install it
http://dev.mysql.com/downloads/connector/net/
 
Share this answer
 
v2
C#
<connectionstrings>
  <add name="ApplicationServices" connectionstring="Data Source=00.0.0.0;Initial Catalog=dbname;User Id=user;Password=pass" providername="MySql.Data.MySqlClient" />
</connectionstrings>


CS code
C#
string strConnString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;
 
Share this answer
 
 
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