May 31, 2011 at 12:15 pm
Hello,
I am using SQL Server 2008. When I connect the database engine using the server name MY_CMP\SQL2008 it is easily connected, MY_CMP is the name of my computer, but the problem is when I connect the database from Microsoft Visual C# 2010 Express then it wont be connected. I have written the following code on C# to connect database.
SqlConnection cn = new SqlConnection("server=MY_CMP\SQL2008; uid=sa; pwd=ishwar; database=logindb;");
C# shows an error message "Error 1 Unrecognized escape sequence"
but when I just write MY_CMP instead of MY_CMP\SQL2008 on C# there is no error message shown but the Database Engine on SQL server is not connected.
Please Help me.
June 19, 2011 at 8:26 am
June 19, 2011 at 1:25 pm
To expand on Steve's comment:
If your instance name is contained in a string variable, make sure you do either:
string server = "myServer\\myInstance"; or
string server = @"myServer\myInstance";
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy