insert into class (id,name,path,click,addDate,parent,lastChildClass) values ('~F','fh','e:\fh',1,curdate(),'~','0')
以上语句在MYSQL中执行通过,没有问题,但是在.NET中调用这个语句时抛出异常“You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '~','0')" at line 1”
这是怎么回事?

解决方案 »

  1.   

    问题是:这个异常的意思不是说SQL语法错误么?
      

  2.   

    'e:\fh' ???
    不转义? 
      

  3.   

    insert into class (id,name,path,click,addDate,parent,lastChildClass) values ('~F','fh','e:\\fh\\',1,curdate(),'~','0')
    这样
      

  4.   

    你的.NET程序没有生成正确的SQL语句字符串!
      

  5.   

    用console.writeline(s);
    打出来看看是什么。
      

  6.   

    问题解决了,确实是.NET那边出了问题谢谢楼上朋友们的热心帮助