this.thisComm.CommandText = "DELETE FROM 管理员 WHERE 名称 = \"" + this.lstUser.SelectedItem + "\" AND 口令 = Null";
应该怎样改呢?

解决方案 »

  1.   

    this.thisComm.CommandText = "DELETE FROM 管理员 WHERE 名称 = '" + this.lstUser.SelectedItem + "' AND 口令 = Null";
      

  2.   

    要用单引号,而不是转义符加双引号
    WHERE 名称 = '" + this.lstUser.SelectedItem + "' AND 口令 = Null"
    而不是
    WHERE 名称 = \"" + this.lstUser.SelectedItem + "\" AND 口令 = Null";怎么一样了??
    困惑
      

  3.   

    不是空,而是没有值啊?
    口令=""
    口令=Null
    是两回事啊
      

  4.   

    this.thisComm.CommandText = "DELETE FROM 管理员 WHERE 名称 = '" + this.lstUser.SelectedItem + "' AND 口令 = Null";
      

  5.   

    IsNull(口令) OR 口令 = '' 
    好象这样可以的
      

  6.   

    = null 是行不通的,可以 this.thisComm.CommandText = "DELETE FROM 管理员 WHERE 名称 = \"" + this.lstUser.SelectedItem + "\" AND 口令 is Null";