【发布时间】:2016-10-05 07:59:06
【问题描述】:
我想在 Access 中插入一个日期时间值,但出现此错误:
net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.4 数据异常:日期时间格式无效
代码如下:
private void txtsubmitActionPerformed(java.awt.event.ActionEvent evt) {
SimpleDateFormat A = new SimpleDateFormat("dd/MM/yyyy");
Peminjaman P= new Peminjaman(setIDTrans(),txtid.getText(),A.format(txttglpinjam.getDate()),A.format(txttglkembali.getDate()),txtplat.getText(),txtnama.getText(),txtdriver.getText());
c.InsertPeminjamanD(P);
【问题讨论】:
-
您可以尝试使用
#17/04/2004#而不是17/04/2004作为日期字符串,如techonthenet.com/access/functions/date/format.php 所示。如果这解决了您的问题,请反馈,然后我将我的评论作为您接受的答案。
标签: java ms-access jdbc ucanaccess