⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 administratorinterface.java

📁 一个完整的物业管理系统
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                 if(status!=0)                      jTextArea4.append("插入成功\n");                 else                     jTextArea4.append("插入失败\n");                 //ResultSet rs=stmt.executeQuery("select * from fangchan");                 //System.out.println(zc.face.MySqlUnit.printResultSet(rs));                 stmt.close();                 con.close();              }              catch(SQLException e){                     e.printStackTrace( );                     jTextArea4.append("\n"+e.toString( )+"\n");                                 }                   }            else           jTextArea4.setText("输入正确的Insert语句.");            // Add your handling code here:  }//GEN-LAST:event_jMenuItem5ActionPerformed  private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed      zc.JFrame1 jf=new zc.JFrame1();      jf.setVisible(true);      setVisible(false);            // Add your handling code here:  }//GEN-LAST:event_jMenuItem1ActionPerformed  private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed            String input=null;      javax.swing.JFrame f=new javax.swing.JFrame();      input=javax.swing.JOptionPane.showInputDialog(f,"请输入Delete语句","Input",javax.swing.JOptionPane.QUESTION_MESSAGE);      //jTextArea4.setText("数据删除........");      if((input!=null)&&(input.length()!=0)){              jTextArea4.setText("SQL查询:\n"+input+"\n");              //System.out.println(input);              //进行数据删除              try{                  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");              }              catch(ClassNotFoundException ce){                  ce.printStackTrace( );                  jTextArea4.append("\n"+ce.toString( )+"\n");                                }             try{                 Connection con=DriverManager.getConnection("jdbc:odbc:houqin");                 Statement stmt=con.createStatement();                 int status=stmt.executeUpdate(input);                 //ResultSet rs=stmt.executeQuery("select * from renyuan");                 if(status!=0)                      jTextArea4.append("删除成功\n");                 else                     jTextArea4.append("删除失败\n");                 //System.out.println(zc.face.MySqlUnit.printResultSet(rs));                 stmt.close();                 con.close();              }              catch(SQLException e){                     e.printStackTrace( );                     jTextArea4.append("\n"+e.toString( )+"\n");                                  }                   }            else           jTextArea4.setText("请输入正确的Delete语句.");            // Add your handling code here:  }//GEN-LAST:event_jMenuItem4ActionPerformed  private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed      String input=null;      javax.swing.JFrame f=new javax.swing.JFrame();      input=javax.swing.JOptionPane.showInputDialog(f,"请输入Update语句","Input",javax.swing.JOptionPane.QUESTION_MESSAGE);           if((input!=null)&&(input.length()!=0)){              jTextArea4.setText("SQL查询:\n"+input+"\n");              //进行数据更新              try{                  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");              }              catch(ClassNotFoundException ce){                    ce.printStackTrace( );                    jTextArea4.append("\n"+ce.toString( )+"\n");                                  }             try{                 Connection con=DriverManager.getConnection("jdbc:odbc:houqin");                 Statement stmt=con.createStatement();                 int status=stmt.executeUpdate(input);                 if(status!=0)                     jTextArea4.append("更新成功\n");                 else                     jTextArea4.append("更新失败\n");                 //ResultSet rs=stmt.executeQuery("select * from fangchan");                 //System.out.println(zc.face.MySqlUnit.printResultSet(rs));                 stmt.close();                 con.close();              }              catch(SQLException e){                     e.printStackTrace( );                     jTextArea4.append("\n"+e.toString( )+"\n");                                  }                   }            else          jTextArea4.setText("输入正确的Update语句.");      // Add your handling code here:  }//GEN-LAST:event_jMenuItem6ActionPerformed  private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed            String input=null;      javax.swing.JFrame f=new javax.swing.JFrame();      input=javax.swing.JOptionPane.showInputDialog(f,"请输入Update语句","Input",javax.swing.JOptionPane.QUESTION_MESSAGE);            if((input!=null)&&(input.length()!=0)){             jTextArea4.setText("SQL查询:\n"+input+"\n");              //进行数据更新              try{                  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");              }              catch(ClassNotFoundException ce){                    ce.printStackTrace( );                    jTextArea4.append("\n"+ce.toString( )+"\n");                                }             try{                 Connection con=DriverManager.getConnection("jdbc:odbc:houqin");                 Statement stmt=con.createStatement();                 int status=stmt.executeUpdate(input);                 if(status!=0)                     jTextArea4.append("更新成功\n");                 else                     jTextArea4.append("更新失败\n");                 //ResultSet rs=stmt.executeQuery("select * from renyuan");                 //System.out.println(zc.face.MySqlUnit.printResultSet(rs));                 stmt.close();                 con.close();              }              catch(SQLException e){                     e.printStackTrace( );                     jTextArea4.append("\n"+e.toString( )+"\n");                                  }                 }            else          jTextArea4.setText("输入正确的Update语句.");      // Add your handling code here:  }//GEN-LAST:event_jMenuItem3ActionPerformed  private void jMenuItem16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem16ActionPerformed             try{                  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");              }              catch(ClassNotFoundException ce){                    ce.printStackTrace( );                    jTextArea4.append("\n"+ce.toString( )+"\n");                                 }  try{        Connection con=DriverManager.getConnection("jdbc:odbc:houqin");        jTextArea4.setText("链接成功\n");        String query=JOptionPane.showInputDialog(              "请输入SQL语句 如 select * from renyuan");         if(query.length( )==0) query="select * from renyuan";         Statement stmt=con.createStatement( );         ResultSet rs=stmt.executeQuery(query);         jTextArea4.setText("SQL语句:"+query+"\n");         while(rs.next( ))             jTextArea4.append(rs.getString(1)+"\t"+rs.getString(2)+"\t"+rs.getString(3)+"\t"+                            rs.getString(4)+"\t"+rs.getString(5)+"\t"+rs.getString(6)+"\t"+                            rs.getString(7)+"\t"+rs.getString(8)+"\t"+rs.getString(9)+"\n");    }  catch(SQLException ex)  {      System.err.println("SQLException:"+ex.getMessage( ));  }       /** String input=null;      javax.swing.JFrame f=new javax.swing.JFrame();      input=javax.swing.JOptionPane.showInputDialog(f,"请输入sql查询语句","Input",javax.swing.JOptionPane.QUESTION_MESSAGE);      //int returnValue=javax.swing.JOptionPane.CANCEL_OPTION;      System.out.println("数据查询.........");      if((input!=null)&&(input.length()!=0)){              System.out.println(input);              //进行数据库查询              try{                  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");              }              catch(ClassNotFoundException ce){                    System.out.println("SQLException:"+ce.getMessage());              }             try{                 Connection con=DriverManager.getConnection("jdbc:odbc:houqin");                 Statement stmt=con.createStatement();                 ResultSet rs=stmt.executeQuery(input);                // System.out.println(zc.face.MySqlUnit.printMetaData(rs));                 System.out.println(zc.face.MySqlUnit.printResultSet(rs));                 stmt.close();                 con.close();              }              catch(SQLException e){                     System.out.println("SQLException:"+e.getMessage());              }             catch(IOException e2){                     System.out.println("IOException:"+e2.getMessage());              }      }      else           System.out.println("输入正确的sql查询语句.");                */      // Add your handling code here:  }//GEN-LAST:event_jMenuItem16ActionPerformed  private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed      String input=null;      javax.swing.JFrame f=new javax.swing.JFrame();      input=javax.swing.JOptionPane.showInputDialog(f,"请输入Insert语句","Input",javax.swing.JOptionPane.QUESTION_MESSAGE);      //System.out.println("数据添加........");      if((input!=null)&&(input.length()!=0)){              jTextArea4.setText("SQL查询:\n"+input+"\n");              //进行数据添加              try{                  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");              }              catch(ClassNotFoundException ce){                    ce.printStackTrace( );                    jTextArea4.append("\n"+ce.toString( )+"\n");                                 }             try{                 Connection con=DriverManager.getConnection("jdbc:odbc:houqin");                 Statement stmt=con.createStatement();                 int status=stmt.executeUpdate(input);                 if(status!=0)                     jTextArea4.append("插入成功\n");                 else                     jTextArea4.append("插入失败\n");                 //ResultSet rs=stmt.executeQuery("select * from renyuan");                // System.out.println(zc.face.MySqlUnit.printResultSet(rs));                 stmt.close();                 con.close();              }              catch(SQLException e){                  e.printStackTrace( );                  jTextArea4.append("\n"+e.toString( )+"\n");                                }                   }            else           jTextArea4.setText("输入正确的Insert语句.");            // Add your handling code here:  }//GEN-LAST:event_jMenuItem2ActionPerformed  private void jMenuItem14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem14ActionPerformed      String input=null;      javax.swing.JFrame f=new javax.swing.JFrame();      input=javax.swing.JOptionPane.showInputDialog(f,"请输入Delete语句","Input",javax.swing.JOptionPane.QUESTION_MESSAGE);      if((input!=null)&&(input.length()!=0)){                           jTextArea4.setText("SQL查询:\n"+input+"\n");              //进行数据删除              try{                  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");              }              catch(ClassNotFoundException ce){                  ce.printStackTrace( );                  jTextArea4.append("\n"+ce.toString( )+"\n");                               }             try{                 Connection con=DriverManager.getConnection("jdbc:odbc:houqin");                 Statement stmt=con.createStatement();                 int status=stmt.executeUpdate(input);                 if(status!=0)                     jTextArea4.append("删除成功\n");                 else                     jTextArea4.append("删除失败\n");                 //ResultSet rs=stmt.executeQuery("select * from zhufang");                 //System.out.println(zc.face.MySqlUnit.printResultSet(rs));                 stmt.close();                 con.close();              }              catch(SQLException e){                  e.printStackTrace( );                  jTextArea4.append("\n"+e.toString( )+"\n");                 }                  }            else           jTextArea4.setText("输入正确的Delete语句.");            // Add your handling code here:  }//GEN-LAST:event_jMenuItem14ActionPerformed  private void jMenu5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu5ActionPerformed// Add your handling code here:  }//GEN-LAST:event_jMenu5ActionPerformed    /** Exit the Application */    private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm        System.exit (0);    }//GEN-LAST:event_exitForm    /**    * @param args the command line arguments    */    public static void main (String args[]) {        new AdministratorInterface ().show ();    }    // Variables declaration - do not modify//GEN-BEGIN:variables    private javax.swing.JMenuBar jMenuBar1;    private javax.swing.JMenu jMenu3;    private javax.swing.JMenuItem jMenuItem2;    private javax.swing.JMenuItem jMenuItem3;    private javax.swing.JMenuItem jMenuItem4;    private javax.swing.JMenuItem jMenuItem16;    private javax.swing.JMenu jMenu7;    private javax.swing.JMenuItem jMenuItem12;    private javax.swing.JMenuItem jMenuItem13;    private javax.swing.JMenuItem jMenuItem14;    private javax.swing.JMenuItem jMenuItem19;    private javax.swing.JMenu jMenu6;    private javax.swing.JMenuItem jMenuItem8;    private javax.swing.JMenuItem jMenuItem9;    private javax.swing.JMenuItem jMenuItem10;    private javax.swing.JMenuItem jMenuItem18;    private javax.swing.JMenu jMenu5;    private javax.swing.JMenuItem jMenuItem5;    private javax.swing.JMenuItem jMenuItem6;    private javax.swing.JMenuItem jMenuItem7;    private javax.swing.JMenuItem jMenuItem17;    private javax.swing.JMenu jMenu2;    private javax.swing.JMenuItem jMenuItem11;    private javax.swing.JMenu jMenu1;    private javax.swing.JMenuItem jMenuItem1;    private javax.swing.JScrollPane jScrollPane6;    private javax.swing.JTextArea jTextArea4;    // End of variables declaration//GEN-END:variables}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -