<configuration> <!--<configSections> </configSections>--> <connectionStrings> <add name="ConnectionName" providerName="System.Data.SqlClient" connectionString="Data Source=MyServerName;Initial Catalog=MyDatabaceName;Integrated Security=True" /> </connectionStrings> </configuration>
SqlConnection Sqlc = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionName"].ConnectionString);
OpenConnection(Sqlc); public bool OpenConnection(SqlConnection con) { if (Sqlc.State == System.Data.ConnectionState.Closed) Sqlc.Open(); //error is here:' Instance failure' return true; }
<add name="conn" connectionstring="Server=MyServerName;Database=myDataBase;Integrated Security=true;" providername="System.Data.SqlClient"/>
<add name="conn" connectionstring="Server=.;Database=myDb;Trusted_Connection=True;" providername="System.Data.SqlClient" />
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)