In my web application i am using SQL server 2008 .. but for some purpose i want to check one table in the Mysql database...is it possible to access sql and mysql in one web application.
In web config i had given this connection strings
<connectionStrings>
<add name="sqlDB" connectionString="Data Source=localhost;Initial Catalog=SQLDatabase;User ID=user1;Password=passwd1" providerName="System.Data.SqlClient" />
<add name="mysqlDB" connectionString="Data Source=localhost;Initial Catalog=MYSQLDatabase;User ID=user2;Password=passwd2" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
in my cs file.
public void test()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["mysqlDB"].ToString());
con.Open();
SqlCommand cmd = new SqlCommand("select * from jobs ", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
}
but the connection is not establishing..It is showing the error like this
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server
How can i solve this ....