473,404 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Unrecognized escape sequence

Hey

asp.net 2.0

I'm developing a website using visual web developer 2005 express. In this
project I'm trying to connect to the aspnetdb.mdf database (the project's
own database created by wvd).

This is my connection string:
SqlConnection conn = new SqlConnection("Data Source=.\SQLEXPRESS;Integrated
Security=True;");

But the "\" in the connection string gives this error :
"unrecognized escape sequence"
But at this link they are using "\":
http://msdn2.microsoft.com/en-us/lib...=printer).aspx

Any ideas what I should fix in my connection string so I can connect to the
database?

Jeff
Jun 30 '06 #1
1 3388
On Fri, 30 Jun 2006 21:49:15 +0200, "Jeff"
<it************@hotmail.com.NOSPAM> wrote:
Hey

asp.net 2.0

I'm developing a website using visual web developer 2005 express. In this
project I'm trying to connect to the aspnetdb.mdf database (the project's
own database created by wvd).

This is my connection string:
SqlConnection conn = new SqlConnection("Data Source=.\SQLEXPRESS;Integrated
Security=True;");

But the "\" in the connection string gives this error :
"unrecognized escape sequence"
But at this link they are using "\":
http://msdn2.microsoft.com/en-us/lib...=printer).aspx

Any ideas what I should fix in my connection string so I can connect to the
database?

Jeff


The \ character is used as the escape character in C#. This lets you use
things like \n for the newline character. Thus to put a \ in a C# string
you need to use \\ for one \.

new SqlConnection("Data Source=.\\SQLEXPRESS;Integrated Security=True;")

Alternativly you can place an @ at the start of the string (before the
quote character) to tell C# not to use escape characters for this
string.

new SqlConnection(@"Data Source=.\\SQLEXPRESS;Integrated
Security=True;")
Jul 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Joe | last post by:
I'm using Python 2.4 on Windows XP SP2. I'm trying to receive a command line argument that is a newline (\n) Here is the command line to use sample.py "\n" Here is a sample.py script
14
by: Jon Maz | last post by:
Hi, I have been getting hopelessly confused with escaping escape characters in JScript! All I want to do is write a simple funtion: function DoubleUpBackSlash(inputString) { ??????? }
1
by: PK9 | last post by:
I'm trying to validate input from a textbox in the code-behind of my page. I don't want to use any validator controls for this, I'd like to do it all in the code behind. However, I'm getting an...
7
by: N U | last post by:
How to program your own escape sequence using basic functions available in C?
7
by: teachtiro | last post by:
Hi, 'C' says \ is the escape character to be used when characters are to be interpreted in an uncommon sense, e.g. \t usage in printf(), but for printing % through printf(), i have read that %%...
2
by: junky_fellow | last post by:
N869 " Each of these escape sequences shall produce a unique implementation-defined value which can be stored in a single char object. The external representations in a text file need not be...
2
by: Christopher Ireland | last post by:
Hi -- Any ideas on this one please ... The following code works as expected: private void Form1_Load(object sender, System.EventArgs e) { string text = "The quick brown"+ " FOX " +"jumps over...
4
by: Abraham Luna | last post by:
can anyone tell me why this string throws an error: strValues += "<tr><td><a href=\"\#\" onclick=\"javascript:" + strTextBox + ".value='" + drRDK.ToString().Replace("\\", "\\\\").Replace("'",...
6
by: sloan | last post by:
I have a fairly simple RegEx code below. I am given a file name, (which I don't control) , and need to change a folder name in it. The code below is choking on the filename not being...
5
by: vlsidesign | last post by:
The printf function returns "warning: unknown escape sequence: \040" for a backslash-space combination. If the ascii decimal number for space is 32 and the backslash is 92, why this particular...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.