Hi
ConfigurationManager.ConnectionStrings() method will read connection string from the app.config file. you cannot directly pass connection string as parameter in the ConfigurationManager.ConnectionStrings() method. First you have to add connection string in app.config file and then need to use that connectionstring name in ConfigurationManager.ConnectionStrings() method parameter
App.Config :
<configuration>
<connectionstrings>
<add name="MyConnectionString" providername="System.Data.SqlClient">
connectionString="Data Source=localhost;Initial Catalog=MyDB; Integrated Security=true" />
</add></connectionstrings>
</configuration>
Now Use this connectionstring in code as
string conString = ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString;
Hope this will help :)
Thanks
Vinod