Friday, March 30, 2012

Instance failure.

why I am getting (Instance failure.) when trying to connect to sql server from the web.config connectionstring..

the web.config entry is :

<connectionStrings>

<addname="website_connectionstring"connectionString="Data Source=.\\SQLEXPRESS;initial catalog=zatoor;integrated security=true"providerName="System.Data.SqlClient" />

<!--

<remove name="website_connectionstring"/>

<add name="website_connectionstring" connectionString="Server=whsql-v21.prod.mesa1.secureserver.net;Database=DB_143379;User ID=zatoor;Password=Mujtaba2007;Trusted_Connection=False" providerName="System.Data.SqlClient" />

-->

</connectionStrings>

the code is :

sql_connection =newSqlConnection(ConfigurationManager.ConnectionStrings["website_connectionstring"].ToString());

sql_connection.Open();

It looks you have provided wrong data source .. to confirm this login to sql management studio and check it should be

YouMachineName\SQLEXPRESS confirm the same and update the connectionString

This will solve the problem

Satya

sql

No comments:

Post a Comment