獲取前:

獲取後:

導致sa登入失敗的問題

string strCon = "workstation id=localhost;packet size=4096;user id=" + user + ";data source=" + dbserver + ";persist security info=True;password=";

//判斷資料庫例項名中是否包含字串'\',如果包含'\'的話,替換'\\'為'\'

if (strCon.Contains(@"\"))
                                            {
                                                _node.Item(i).Attributes.GetNamedItem("value").InnerText = strCon.Replace(@"\\",@"\");
                                            }
                                            else
                                            {
                                                _node.Item(i).Attributes.GetNamedItem("value").InnerText = strCon;
                                            }