2017-11-20 12 views
0

Jdeveloper 11g에서 SQL Server 테이블에 데이터를 삽입하려고했지만 어떻게 든 작동하지 않습니다.Jdeveloper 11g에서 SQL Server 테이블에 데이터 삽입

여기 내 코드입니다 :

public void theQuery(String query) { 
    Statement statement = null;    
    Connection connection = null; 

    try {     
     connection = DriverManager.getConnection("jdbc:sqlserver://localhost/PROGRAII","root",""); 
     statement = connection.createStatement();     
     statement.executeUpdate(query);      
     JOptionPane.showMessageDialog(null, "Se realizó la operación");    
    }    
    catch (Exception ex) { 
      JOptionPane.showMessageDialog(null, "NO se realizó la operación"); 
    }     
}  

그리고 이것은 문자열입니다 : 나는 당신이 "'"+this.jTexEmail.getText()","+this.jTexEmail.getText()를 교체 할 필요가 있다고 생각

private void jButAceptar_actionPerformed(ActionEvent e) {   
try {    
inserta.theQuery("insert into ControlAcceso(cedula,email,clave) values('"+this.jTexCedula.getText()+"'," +      ","+this.jTexEmail.getText()+"','"+this.jTexClave.getText()+"')");     } catch (Exception ex) {    
JOptionPane.showMessageDialog(null, "No se realizo el query");   } 

답변