在sql中,两个连续的单引号在字符串内代表一个单引号

解决方案 »

  1.   

    print 'can'+ ''''+'t update'
      

  2.   

    用两上单引号,来表示一个单引号try
      

  3.   

    print 'can'+ ''''+'t update'
    print 'can''t update'
      

  4.   

    print 'can'+ ''''+'t update'
    print 'can''t update'
      

  5.   

    輸入時 printcan't update  改為 printcan''t update
      

  6.   

    我觉得这个问题只要控制输入时就可以了
    比如vb中
    update table1 set col1=replace(textbox1.text,"'","''")
      

  7.   

    假设查询条件在 @w 中:declare @s varchar(200)
    set @s=replace(@w,char(39),char(39)+char(39))
    declare @sql varchar(4000)
    set @sql='select abc from def where ('+@s+')'
    exec(@sql)