【问题标题】:ADO.NET connection string and password with "=" in itADO.NET 连接字符串和密码,其中带有“=”
【发布时间】:2010-04-06 13:46:07
【问题描述】:

如何建立一个连接字符串,其中包含一个“=”的密码? (我正在连接到 MySql 5.1)

例如,假设密码是“Ge5f8z=6”,连接字符串会是什么样子?

我试过了:

Server=DBSERV;Database=mydb;UID=myuser;PWD="Ge5f8z=6";

Server=DBSERV;Database=mydb;UID=myuser;PWD=Ge5f8z=6;"

两者都不起作用。

【问题讨论】:

    标签: mysql ado.net connection-string


    【解决方案1】:

    使用两个 == 符号。

    原来如此

      Server=DBSERV;Database=mydb;UID=myuser;PWD=Ge5f8z==6;"
    

    【讨论】:

    • 你可以使用 "" 转义 : 或 ;
    • @Nix 我试过string connstr = "Server=localhost;Port=3306;Database=test;User=root;Password=\"t;jd\";"; 连接到mysql db,但是,它不起作用。我已经阅读了@CResults 发布的页面,这里引用了To include values that contain a semicolon, single-quote character, or double-quote character, the value must be enclosed in double quotes. 我错过了什么吗?
    【解决方案2】:

    在它前面加上另一个 =,所以 Ge5f8z==6 应该可以工作

    来源http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring(VS.71).aspx

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-11-04
      • 2021-09-17
      • 2015-09-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多