'instance failure' error while connection string is correct

I have connection:

Data Source=MyComputerName\SQL2012ENTERPRS;Initial Catalog=RESTFUL; User Id=myuser; Password=mypass123;

My server is : MyComputerName\SQL2012ENTERPRS

But since I use string, I add more \ so, at my code It will be:

public string connectionString = "Data Source=DAFWKN409C67Q\\SQL2012ENTERPRS;Initial Catalog=RESTFUL; User Id=rest_user; Password=rest_pwd_01;";

I have forgoten that I must remove one of \ since I am not use default string block, I use XML file to save my connection string. Then everything is ok. So, my suggestion is your instance name is not correct.

This is my connection string sample it I use local pc using SQL express:

string servername = @"Data Source=.\SQLExpress;Initial Catalog=Workshop;Integrated Security=True";

You should modify with your server name, and instance name by yourself, make sure it correct.


As you got the error "instance failure", that might be the error with your SQL Server instance..

Make sure your SQL Server instance(MSSQLSERVER) is running, where you can check in: Services list. TO get into services list: open run dialog box and type: "services.msc" (without quotes) and hit Enter. That takes you to services management console, where you can check whether your instance in running or not..

If the problem still persists, then try using: Data Source=.\SQLEXPRESS instead.. :)

Happy Coding... :)