I am trying to set the mysql connection in web config file.
Here is the connection string code:
<connectionStrings>
<add name="connstring"
connectionString="DRIVER={MySQL ODBC= 3.51= Driver};Database=marctest;Server=localhost;UID=root;PWD=1234;"
providerName="System.Data.SqlClient"/>
</connectionStrings>
and i am accessing it in following step:
MySqlConnection connmysql = new MySqlConnection(WebConfigurationManager.ConnectionStrings["connstring"].ConnectionString);
When I run my code it generates a null reference exception."Object reference not set to an instance of an object."
How can I resolve this issue?