Where can i find the data source of connectionString in MySql

0

This is my web.config

 <connectionStrings>
    <add name="SocialNetworkConnection" connectionString="Data Source='MySQL Database (MySQL Data Provider)';Initial Catalog=socialnet;Integrated Security=True"
      providerName="System.Data.SqlClient" />
    <add name="socialnetConnectionString" connectionString="server=localhost;user id=root;password=Decewber@25!12;persistsecurityinfo=True;database=socialnet"
      providerName="MySql.Data.MySqlClient" />
</connectionStrings>

This is my connection

str = ConfigurationManager.ConnectionStrings["socialnetConnectionString"].ConnectionString;

myConnection = new SqlConnection(str);

myConnection.Open();

But it shows an error:

System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 Error Locating Server/Instance Specified)

Can you help me?

c#
mysql
asp.net
asked on Stack Overflow May 2, 2020 by Ester • edited May 2, 2020 by Guru Stron

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0