strSql := 'insert into YJ_player (player) values (''' + strPlayer + ''') + ')';假如变量 strPlayer 中 包含 ' 后会提示错误~~
如何解决这个问题呢???

解决方案 »

  1.   

    另外我记得sql语句中的单引号可以用双引号替换吧
      

  2.   


    sql语句怎么写呢????
      

  3.   

    建议判断strPlayer是否有'
    有就用''代替
      

  4.   

    对于可能会出现特殊字符的情况,建议直接使用Append Post处理,这样任何数据库认可的字符都能正常操作.用''代替' 我倒是没用过,但不可能在整个语句中所有变量都使用上吧
    我们还要注意一下不可预见性的问题.
      

  5.   

    我用的是笨方法:
    1.在輸入時,強製不讓單引號輸入,在keypress中實現;
    2.對于已經存在的單引號,在執行sql時用stringreplace處理;
      

  6.   

    strSql := 'insert into YJ_player (player) values (''' + strPlayer + ''') + ')'; 
    红色那个括号是用来干什么的?