逃生和放大器;在App.config中 [英] Escape & in App.config

查看:142
本文介绍了逃生和放大器;在App.config中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在App.config文件下面这段配置的:

I have the following piece of config in my App.config file:

<add key="ConnectionString" 
     value="INITIAL CATALOG=myDatabase;DATA SOURCE=myServer;User ID=myUser;Password=!&myPass99;"/>

上面的连接字符串是由Visual Studio智能感知拒绝。它说,实体 myPass99 没有定义。的问题是由&安培引起的;在密码。

The above connection string is rejected by Visual Studio intellisense. It says entity myPass99 not defined. The problem is caused by the & in the password.

我如何逃生呢?

推荐答案

使用&放逃生的符号;代替&放;放大器;

Escape the ampersand by using &amp; in place of the &

作为一个供参考,在这里看到更多的字符: <一href="http://stackoverflow.com/questions/1091945/where-can-i-get-a-list-of-the-xml-document-escape-characters">Where我能得到的XML文档中的转义字符列表?

As an FYI, see here for further characters: Where can I get a list of the XML document escape characters?

这篇关于逃生和放大器;在App.config中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆