编译错误 
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误信息: CS1003: 语法错误,应输入“:”源错误: 行 22: xmldoc.Load(Server.MapPath("contents.xml")); 
行 23: string InsStr="<topic><title>" & TextBox2.Text & "</title><href>";
行 24: main.aspx?name= & TextBox1.Text & "</href></topic>";
行 25: XmlDocumentFragment docFrag = xmldoc.CreateDocumentFragment(); 
行 26: docFrag.InnerXml = InsStr; 
 

解决方案 »

  1.   

    行 23: string InsStr="<topic><title>" & TextBox2.Text & "</title><href>";
    行 24: main.aspx?name= & TextBox1.Text & "</href></topic>";
    上面两行换成
    string InsStr="<topic><title>" + TextBox2.Text + "</title><a href= main.aspx?name=" + TextBox1.Text + "</href></topic>";
      

  2.   

    xmldoc.Load(Server.MapPath("contents.xml")); 
     string InsStr="<topic><title>" & TextBox2.Text & "</title><href>main.aspx?name=" & TextBox1.Text & "</href></topic>";
     XmlDocumentFragment docFrag = xmldoc.CreateDocumentFragment(); 
     docFrag.InnerXml = InsStr;
      

  3.   

    C#中不应该用&号,都改为+号应该就没错了