To com um problema não consigo fazer meu codigo funcionar, ja tentei de varias fomas e sempre acusa o mesmo erro…
symbol : method executeUpdate(java.lang.String)
location: class java.beans.Statement
operacao.executeUpdate(“INSERT INTO unidade(CodigoFilme, NomeFIlme, Quantidade)Values(’”+tfCodigoFilme.getText()+"’,’"+tfNomeFilme.getText()+"’,’"+tfQuantidade.getText()+"’)");
1 error
BUILD FAILED (total time: 0 seconds)
/*
* DialogFilmesForm.java
*
* Created on 15 de Junho de 2006, 13:21
*/
package locprojectbasico;
import java.beans.Statement;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
/**
*
* @author Kremer
*/
public class DialogFilmesForm extends javax.swing.JDialog {
/** Creates new form DialogFilmesForm */
public DialogFilmesForm(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
setTitle("Cadastro De Filmes");
setSize(380,180);
setLocationRelativeTo(null);
// Tenta Conectar usando o arquivos Conectar
try{
locprojectbasico.Conectar.init();
}
catch(IOException ex){
ex.printStackTrace();
}catch(ClassNotFoundException ex){
ex.printStackTrace();
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jlCodFilme = new javax.swing.JLabel();
jlNomeFilme = new javax.swing.JLabel();
jlQuantidade = new javax.swing.JLabel();
jlTipo = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
tfCodigoFilme = new javax.swing.JTextField();
tfNomeFilme = new javax.swing.JTextField();
tfQuantidade = new javax.swing.JTextField();
jPanel4 = new javax.swing.JPanel();
jcbDVD = new javax.swing.JCheckBox();
jcbVHS = new javax.swing.JCheckBox();
jPanel3 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jPanel5 = new javax.swing.JPanel();
jbInserir = new javax.swing.JButton();
jbSair = new javax.swing.JButton();
jPanel6 = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jPanel1.setLayout(new java.awt.GridLayout(4, 0, 1, 1));
jlCodFilme.setText(" C\u00f3digo Filme : ");
jPanel1.add(jlCodFilme);
jlNomeFilme.setText(" Nome Filme :");
jPanel1.add(jlNomeFilme);
jlQuantidade.setText(" Quantidade :");
jPanel1.add(jlQuantidade);
jlTipo.setText(" Tipo :");
jPanel1.add(jlTipo);
getContentPane().add(jPanel1, java.awt.BorderLayout.WEST);
jPanel2.setLayout(new java.awt.GridLayout(4, 0, 0, 3));
jPanel2.add(tfCodigoFilme);
jPanel2.add(tfNomeFilme);
jPanel2.add(tfQuantidade);
jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.X_AXIS));
jcbDVD.setSelected(true);
jcbDVD.setText("DVD");
jPanel4.add(jcbDVD);
jcbVHS.setText("VHS");
jPanel4.add(jcbVHS);
jPanel2.add(jPanel4);
getContentPane().add(jPanel2, java.awt.BorderLayout.CENTER);
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12));
jLabel1.setText("CADASTRO FILMES");
jPanel3.add(jLabel1);
getContentPane().add(jPanel3, java.awt.BorderLayout.NORTH);
jPanel5.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 1, 5));
jbInserir.setText("Inserir");
jbInserir.setPreferredSize(new java.awt.Dimension(75, 20));
jbInserir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbInserirActionPerformed(evt);
}
});
jPanel5.add(jbInserir);
jbSair.setMnemonic('S');
jbSair.setText("Sair");
jbSair.setPreferredSize(new java.awt.Dimension(75, 20));
jbSair.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbSairActionPerformed(evt);
}
});
jPanel5.add(jbSair);
getContentPane().add(jPanel5, java.awt.BorderLayout.SOUTH);
getContentPane().add(jPanel6, java.awt.BorderLayout.EAST);
pack();
}
// </editor-fold>
private void jbSairActionPerformed(java.awt.event.ActionEvent evt) {
dispose();
}
private void jbInserirActionPerformed(java.awt.event.ActionEvent evt) {
Connection con = null;
Statement operacao = null;
try {
locprojectbasico.Conectar.init();
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
try{
con = locprojectbasico.Conectar.getConnection();
}catch(SQLException ex){
ex.printStackTrace();}
try{
operacao = (Statement)con.createStatement();
}catch(SQLException ex){
ex.printStackTrace();}
try{
operacao.executeUpdate("INSERT INTO unidade(CodigoFilme, NomeFIlme, Quantidade)Values('"+tfCodigoFilme.getText()+"','"+tfNomeFilme.getText()+"','"+tfQuantidade.getText()+"')");
}catch(SQLException ex){
ex.printStackTrace(); }
try{
con.close();
}catch(SQLException ex){
ex.printStackTrace(); }
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new DialogFilmesForm(new javax.swing.JFrame(), true).setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JButton jbInserir;
private javax.swing.JButton jbSair;
private javax.swing.JCheckBox jcbDVD;
private javax.swing.JCheckBox jcbVHS;
private javax.swing.JLabel jlCodFilme;
private javax.swing.JLabel jlNomeFilme;
private javax.swing.JLabel jlQuantidade;
private javax.swing.JLabel jlTipo;
private javax.swing.JTextField tfCodigoFilme;
private javax.swing.JTextField tfNomeFilme;
private javax.swing.JTextField tfQuantidade;
// End of variables declaration
}
se puderem me ajudar eu agradeço !