Hi,
I want to connect database through configaration file. I am getting error.
Here is my code:
Configuration file:<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="databaseconnectionstring" connectionString="i wrote connection string here"/>
</connectionStrings>
</configuration>
My code in c# is:
string connStr = ConfigurationManager.ConnectionStrings["databaseconnectionstring"].ConnectionString;
SqlConnection con = new SqlConnection(connStr);
con.open();
Thanks
Darma