[英]Main method not found error
我是jdbc的新手,我嘗試通過數據庫形式的IDE連接。下面的代碼是我寫的;
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try {
DriverManager.registerDriver(new org.apache.derby.jdbc.ClientDriver());
Connection conn=DriverManager.getConnection("jdbc:derby://localhost:1527/sample","app","app");
preparedStatement ps=conn.prepareStatement("select name,zip,discount_code from customer where customer_id=?");
ps.setInt(1,Interger.parseInt(jTextField1.getText()));
ResultSet rs=ps.executeQuery();
if(rs.next()) {
jTextField2.setText(rs.getString(1));
jTextField3.setText(rs.getString(2));
jComboBox1.setSelectedItem(rs.getString(3));
}
} catch (NumberFormatException ex) {
ex.PrintStackTrace();
}catch (SQLException ex){
ex.printStackTrace();
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new jdfrm().setVisible(true));
}
}
}
錯誤是..class“ frm1.jdfrm”沒有主要方法
您的main
形式在private void jButton1ActionPerformed
..內部檢查括號
您的括號看起來不正確。 您需要在main方法之前再次關閉。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.