When I try to connect my MySql Database in web.config and create object in my class file it give me server error. My Connection string is bellow.
<add name="MyConn" providerName="MySql.Data.MySqlClient" connectionString="Server=localhost;User ID=root;Password=demo@123;Database=pay2school;port=3306;pooling=false;respect binary flags=false"/>
My Cs code is below
MySqlConnection conn = new MySqlConnection();
string datacon;
protected void Page_Load(object sender, EventArgs e)
{
datacon = ConfigurationManager.ConnectionStrings["MyConn"].ToString();
conn = new MySqlConnection(datacon);
//conn.ConnectionString = datacon;
// conn = new MySqlConnection(ConfigurationManager.ConnectionStrings["MyConn"].ConnectionString);
Response.Write(conn);
}
I got error is below
Server Error in '/WebSite1' Application. Keyword not supported. Parameter name: respect binary flags Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Keyword not supported. Parameter name: respect binary flags
Source Error:
Line 20:
Line 21: datacon = ConfigurationManager.ConnectionStrings["MyConn"].ToString();
Line 22: conn = new MySqlConnection(datacon);
Line 23: //conn.ConnectionString = datacon;
Line 24: // conn = new MySqlConnection(ConfigurationManager.ConnectionStrings["MyConn"].ConnectionString);
Please Help me.