如何使用C#向MySQL数据插入日期时间戳数据

2024-12-02 07:23:08
推荐回答(1个)
回答1:

请参考
public static void insertDemo(String[] args) throws Exception {
MsgSwapDAOImpl dao = new MsgSwapDAOImpl();
Connection conn = dao.jdbcUtil.getConnection();
String appKey ="40825Td288461463";
String msg = "wlllllll";
conn.setAutoCommit(false);
String sql = "insert into TTT(ID, CREATE_DATE) values(?,?)";
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setInt(1, 888888);
pstmt.setTimestamp(2, TimeUtil.nowTimestamp());