insert into note(TopicLink) values("http://xxx.xxx.xx/xxx.xml")双引号

解决方案 »

  1.   

    我是string strSql="insert into note(TopicLink) values('http://xxx.xxx.xx/xxx.xml')";的
      

  2.   

    楼主
    你确定是这个错误吗?
    我确定这一句sql语句是对的你把你的语句改成
    string sql = @"insert into note(TopicLink) values('http://xxx.xxx.xx/xxx.xml')"
      

  3.   

    to heroyujun
     用双引号不行的
      

  4.   

    我找到原因了:是'号过多的缘故。strTopicLink="<a href='http://127.0.0.1/bbs/data/200303/20030329281.xml' target='_blank'>ceshi</a>";
    string strSql="insert note(TopicLink) values('"+strTopicLink+"')";结果出错了,那怎么样才能把strTopicLink插入数据库?
      

  5.   

    @是对字符串中的特殊字符不转义写成
    string strSql=@"insert note(TopicLink) values('''"+strTopicLink+"''')";
      

  6.   

    string strSql="insert note(TopicLink) values('"+strTopicLink.Replace("'","''")+"')";把单引号转义就好了