Hello to all,
I am calling connection string from app.config
string str = ConfigurationManager.ConnectionStrings["Bank"].ConnectionString;
SqlConnection con = new SqlConnection(str);
my app.config file is
<configuration>
<connectionStrings>
<add name="Bank"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=D:\BankManagement(2)\BankManagement\bin\Debug\BankManagement.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
bt i am getting compilation error:
Error 1 A field initializer cannot reference the non-static field, method, or property