Friday, 13 July 2012

Fixing Instance Failure when connecting to SQL Server

I was getting Instance Failure when connecting to my SQL Server Express 2005 Database in my C# ASP.NET application.  Very weird.

Instance failure. - Windows Internet Explorer

    <add name="NorthwindConnString" 
         connectionString="Data Source=.\\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True" 
Trial and error just taught me that the problem was "Data Source=.\\SQLEXPRESS;" - It's the double \\. That's an escape sequence in C#. Everything worked when I switched the connection string to .\SQLEXPRESS.


Post a Comment

Design by Abhinav Ranjan Sinha