我收到错误无法找到符号,符号:方法 setDate(Date)。
这是我的导入代码:
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Date;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.sql.ResultSet;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import sun.applet.Main;
import javax.swing.table.DefaultTableModel;
这是有错误的代码(第 6 行):
private String idTransaksi() {
try {
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd");
String tanggal = sdf.format(date);
txtDate.setDate(date);
SimpleDateFormat sdf2 = new SimpleDateFormat ("dd.MM.yyyy hh:mm:ss");
String tanggal2 = sdf2.format(date);
String qDate = "SELECT time, sellID FROM mssell";
rs = stm.executeQuery(qDate);
idJual = "Trans." + tanggal2;
String query = "INSERT INTO t_jual VALUES ('"+idJual+"','"+tanggal+"','ADMIN',0,0,'NOTHING')";
stm.executeUpdate(query);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e.getMessage());
}
return idJual;
}
我错过了什么?任何帮助回答表示赞赏。
慕森王
相关分类