jdbc 怎么更新日期时间,我更新后,只有日期,没有时间
 new java.sql.Date(System.currentTimeMillis())
String sql="update TB_Cit set [Transceiver Model]='"+strTm+"',[Customer Model]='"+getCm+"',[PackTime]='"+new java.sql.Date(System.currentTimeMillis())+"' where [serial number]='"+strImei+"'";

更新完后,没有时间啊,怎么加上时间啊,谢谢

解决方案 »

  1.   

    java.sql.Date改成java.util.Date会出现java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] 标准表达式中数据类型不匹配。
      

  2.   

    数据库中不能使用java.util.Date这个类型来表示时间的http://www.pmjava.com/Article/ShowInfo.asp?ID=56465个不知道能不能帮到你
      

  3.   

    SimpleDateFormat  dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String date=dateFormat.format(System.currentTimeMillis()); try {
    conn=JdbcUtils.getConnection();
    st=conn.createStatement();
    String sql="update TB_Cit set [Transceiver Model]='"+strTm+"',[Customer Model]='"+getCm+"',[PackTime]='"+date+"' where [serial number]='"+strImei+"'";
    st.executeUpdate(sql);
    } catch (SQLException e) {
    e.printStackTrace();
    }finally{
    try {
    JdbcUtils.free(rs, st, conn);
    } catch (SQLException e) {
    e.printStackTrace();
    }
    }
    先转化一下,就可以了,谢谢各位了
      

  4.   

     对, 用SimpleDateFormat 格式化下就行啦