Afnan Bashir
Afnan Bashir

Reputation: 7419

Connection SQL server C#

I have Installed SQL server 2008 I want to connect to it using c# i have managed to establish connection by using tools->Connect to database but when i write connection string and try to open the connection then exception occurs "Instance Failure". what is wrong my server name is NEO-SOFT-SOL\SQLEXPRESS and connection string I used is @"Data Source=NEO-SOFT-SOL\\SQLEXPRESS;Initial Catalog=user;Integrated Security=True";

what is wrong?

Upvotes: 2

Views: 237

Answers (1)

Daniel DiPaolo
Daniel DiPaolo

Reputation: 56390

If you're using the @ symbol, then \\ really means two slashes, you probably want just one \

See the verbatim string literals documentation for some examples to help explain.

Upvotes: 7

Related Questions