0
Я получаю следующую ошибку Пожалуйста, помогите. C# кодНевозможно присвоить значение строки подключения
string s2 = System.Configuration.ConfigurationManager.ConnectionStrings["conec"].ToString();
SqlConnection con = new SqlConnection(s2);
App.Config
<add name="conec" connectionString ="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=PACS_ENG_NEW;Data Source=HCL-68\SQLEXPRESS"/>
Ошибка
Error 1 A field initializer cannot reference the non-static field, method, or property 'PDS1.frm_sales.s2' C:\Documents and Settings\admin\My Documents\Visual Studio 2008\Projects\PDS1\PDS1\Sales.cs 28 47 PDS1
Большое спасибо. Это помогло мне :) – Suhas