如下的写法
fieldstr += "\"" + DataKeyGridView.Rows[i].Cells[1].Text + "\"" + ",";
最后fieldstr中还是\",没有转换成双引号。但是在前台又会转成双引号

解决方案 »

  1.   

     string dieldstr = DataKeyGridView.Rows[i].Cells[1].Text + ",";
      

  2.   

    你现在就是对的,不要在debug状态下看fieldstr内容里没有转换似的。
      

  3.   

    我现在需要再把fieldstr这个字符串赋值给一个字符组,然后字符组要做为参数使用。
    我这种写法,在调试时没有转义
      

  4.   

     for (int i = 0; i < DataKeyGridView.Rows.Count - 1; i++)
            {
                CheckBox cbox = (CheckBox)DataKeyGridView.Rows[i].FindControl("CheckBox1");
                if (cbox.Checked)
                {
                    fieldstr +="\"" +DataKeyGridView.Rows[i].Cells[1].Text +"\""+",";
                }
            }
            string[] table = { tablestr };
            string[] field = { fieldstr };
            xop.InsertNode("//UserInformation/User[@ID='" + userid + "']", "DWInformation", table, field);
            xop.Save("~/UserInfo/UserDWInformation.xml");
    这是代码
      

  5.   

     string fieldstr=string.Empty;          fieldstr += DataKeyGridView.Rows[i].Cells[1].Text + ",";
      

  6.   

    想要的结果是,能把字符串tablestr赋值给字符串组string[] table 。因而需要里面有对应的“号了
      

  7.   

    不明白 string str = "1";
    string[] strArr = new[] { str };不需要加 "