I have a following connection string in app.config
<add name="myDBConnectionString"
connectionString="Data Source=ASDFG\SQLEXPRESS;
Initial Catalog=ZAQ;
Integrated Security=True;"/>
in my C# code then, when I get this string DB is always evaluated as "ASDFG\\\\SQLEXPRESS"
I couldn't put @ since app.config doesn't like it. Also, if I say
ASDFG\\SQLEXPRESS
it gets evaluated as
ASDFG\\\\SQLEXPRESS
and not open the connection.
Thank You,
调试器可能会将其显示为ASDFG\\\\SQLEXPRESS
,但只是出于显示目的转义了反斜杠。
use this in codebehind
string conString =
System.Configuration.ConfigurationManager
.ConnectionStrings["myDBConnectionString"].ToString();
always evaluated as "ASDFG\\SQLEXPRESS"
Which is quite correct. Any actual problems opening the Db?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.