Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Unable to connect to any of the specified MySQL hosts.
Source Error:
Line 283: <siteMap>
Line 284: <providers>
Line 285: <add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/"/>
Line 286: </providers>
Line 287: </siteMap>
Source File: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config Line: 285
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1055.0
This is my C# code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class Booking_Location : System.Web.UI.Page
{
SqlConnection conn = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=Murahtour;Integrated Security=True");
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSearch_Click(object sender, EventArgs e)
{
string state = ddlState.SelectedValue;
string str = "SELECT LocTitle FROM Location WHERE LocTitle LIKE '%' + @state + '%'";
SqlCommand cmd = new SqlCommand(str, conn);
cmd.Parameters.Add("@state", SqlDbType.NVarChar).Value = state;
conn.Open();
cmd.ExecuteNonQuery();
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
da.Fill(ds,"Location");
GridView1.DataSource = ds;
GridView1.DataBind();
conn.Close();
}
}
And I've tried to solve this problem by adding
<siteMap>
<providers>
<remove name="MySqlSiteMapProvider"/>
</providers>
</siteMap>
in the Web.config but it shows invalid configuration... I also tried to follow the step in changing installation file for MySQL Connector in this forum
but I do not find any box to be unchecked. Now what should I do... I'm using Microsoft Visual Studio Ultimate 2010 for making an C# ASP.NET website. And I'm using MySQL Connector/C 6.1.