在于你数据库的name字段的默认值。

解决方案 »

  1.   

    ''(空串)和NULL一定要分清楚才行,它们是不同的东西,表示不同的意义。报错是代码书写的问题,把两种东西当成一种东西处理,难免会有问题。
      

  2.   

    你到底用的是“insert into emp(id) values(8)”
    还是“insert into emp values(8,'')”?
      

  3.   

    ''(空串)和NULL怎么能同日而语呢
     
    比如判断时候 :name=''和name is null 这两种是不同的判断
      

  4.   

    关键看你的查询语句怎么写的,查询条件是什么?
    把你的sql语句贴出来看看。
    另外同意楼上两位的
      

  5.   

    错是reading static course!插入语句是"insert into emp values(8,'"+strname+"')",但strname有时候是空("")的,那怎么办呢?那不把空值插入了吗?》
      

  6.   

    插入前if(strname == null || strname.equals("")){
             strname = " ";//给个空格
          }
      

  7.   

    错是reading static course!插入语句是"insert into emp values(8,'"+strname+"')",但strname有时候是空("")的,那怎么办呢?那不把空值插入了吗?》请使用PreparedStatement!