www.pudn.com > 2007419349385.rar > AdministratorInterface.java
/*
* AdministratorInterface.java
*
* Created on 2001年1月15日, 上午10:59
*/
package zc.face;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.sql.*;
/**
*
* @author Administrator
* @version
*/
public class AdministratorInterface extends javax.swing.JFrame {
/** Creates new form AdministratorInterface */
public AdministratorInterface() {
initComponents ();
pack ();
}
/** 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 FormEditor.
*/
private void initComponents() {//GEN-BEGIN:initComponents
jMenuBar1 = new javax.swing.JMenuBar();
jMenu3 = new javax.swing.JMenu();
jMenuItem2 = new javax.swing.JMenuItem();
jMenuItem3 = new javax.swing.JMenuItem();
jMenuItem4 = new javax.swing.JMenuItem();
jMenuItem16 = new javax.swing.JMenuItem();
jMenu7 = new javax.swing.JMenu();
jMenuItem12 = new javax.swing.JMenuItem();
jMenuItem13 = new javax.swing.JMenuItem();
jMenuItem14 = new javax.swing.JMenuItem();
jMenuItem19 = new javax.swing.JMenuItem();
jMenu6 = new javax.swing.JMenu();
jMenuItem8 = new javax.swing.JMenuItem();
jMenuItem9 = new javax.swing.JMenuItem();
jMenuItem10 = new javax.swing.JMenuItem();
jMenuItem18 = new javax.swing.JMenuItem();
jMenu5 = new javax.swing.JMenu();
jMenuItem5 = new javax.swing.JMenuItem();
jMenuItem6 = new javax.swing.JMenuItem();
jMenuItem7 = new javax.swing.JMenuItem();
jMenuItem17 = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
jMenuItem11 = new javax.swing.JMenuItem();
jMenu1 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jScrollPane6 = new javax.swing.JScrollPane();
jTextArea4 = new javax.swing.JTextArea();
jMenu3.setActionCommand("\u4eba\u5458\u4fe1\u606f");
jMenu3.setText("\u4eba\u5458\u7ba1\u7406");
jMenu3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenu3ActionPerformed(evt);
}
}
);
jMenuItem2.setText("\u6dfb\u52a0");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem2ActionPerformed(evt);
}
}
);
jMenu3.add(jMenuItem2);
jMenuItem3.setActionCommand("\u66f4\u65b0");
jMenuItem3.setText("\u66f4\u65b0");
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem3ActionPerformed(evt);
}
}
);
jMenu3.add(jMenuItem3);
jMenuItem4.setText("\u5220\u9664");
jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem4ActionPerformed(evt);
}
}
);
jMenu3.add(jMenuItem4);
jMenuItem16.setText("\u67e5\u8be2");
jMenuItem16.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem16ActionPerformed(evt);
}
}
);
jMenu3.add(jMenuItem16);
jMenuBar1.add(jMenu3);
jMenu7.setLabel("\u4f4f\u623f\u4fe1\u606f\u7ba1\u7406");
jMenu7.setText("\u4f4f\u623f\u7ba1\u7406");
jMenu7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenu7ActionPerformed(evt);
}
}
);
jMenuItem12.setText("\u6dfb\u52a0");
jMenuItem12.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem12ActionPerformed(evt);
}
}
);
jMenu7.add(jMenuItem12);
jMenuItem13.setText("\u66f4\u65b0");
jMenuItem13.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem13ActionPerformed(evt);
}
}
);
jMenu7.add(jMenuItem13);
jMenuItem14.setText("\u5220\u9664");
jMenuItem14.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem14ActionPerformed(evt);
}
}
);
jMenu7.add(jMenuItem14);
jMenuItem19.setText("\u67e5\u8be2");
jMenuItem19.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem19ActionPerformed(evt);
}
}
);
jMenu7.add(jMenuItem19);
jMenuBar1.add(jMenu7);
jMenu6.setText("\u6536\u8d39\u7ba1\u7406");
jMenu6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenu6ActionPerformed(evt);
}
}
);
jMenuItem8.setText("\u6dfb\u52a0");
jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem8ActionPerformed(evt);
}
}
);
jMenu6.add(jMenuItem8);
jMenuItem9.setText("\u66f4\u65b0");
jMenuItem9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem9ActionPerformed(evt);
}
}
);
jMenu6.add(jMenuItem9);
jMenuItem10.setText("\u5220\u9664");
jMenuItem10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem10ActionPerformed(evt);
}
}
);
jMenu6.add(jMenuItem10);
jMenuItem18.setText("\u67e5\u8be2");
jMenuItem18.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem18ActionPerformed(evt);
}
}
);
jMenu6.add(jMenuItem18);
jMenuBar1.add(jMenu6);
jMenu5.setText("\u623f\u4ea7\u7ba1\u7406");
jMenu5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenu5ActionPerformed(evt);
}
}
);
jMenuItem5.setText("\u6dfb\u52a0");
jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem5ActionPerformed(evt);
}
}
);
jMenu5.add(jMenuItem5);
jMenuItem6.setText("\u66f4\u65b0");
jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem6ActionPerformed(evt);
}
}
);
jMenu5.add(jMenuItem6);
jMenuItem7.setText("\u5220\u9664");
jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem7ActionPerformed(evt);
}
}
);
jMenu5.add(jMenuItem7);
jMenuItem17.setText("\u67e5\u8be2");
jMenuItem17.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem17ActionPerformed(evt);
}
}
);
jMenu5.add(jMenuItem17);
jMenuBar1.add(jMenu5);
jMenu2.setText("\u5e2e\u52a9");
jMenu2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenu2ActionPerformed(evt);
}
}
);
jMenuItem11.setText("\u5e2e\u52a9");
jMenuItem11.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem11ActionPerformed(evt);
}
}
);
jMenu2.add(jMenuItem11);
jMenuBar1.add(jMenu2);
jMenu1.setText("\u8fd4\u56de");
jMenu1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenu1ActionPerformed(evt);
}
}
);
jMenuItem1.setText("\u8fd4\u56de");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
}
);
jMenu1.add(jMenuItem1);
jMenuBar1.add(jMenu1);
getContentPane().setLayout(new java.awt.FlowLayout());
setTitle("\u7ba1\u7406\u5458\u754c\u9762");
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
}
);
jTextArea4.setColumns(30);
jTextArea4.setRows(10);
jScrollPane6.setViewportView(jTextArea4);
getContentPane().add(jScrollPane6);
setJMenuBar(jMenuBar1);
}//GEN-END:initComponents
private void jMenuItem11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem11ActionPerformed
String s=" 欢迎进入管理系统 \n"+
" 管理员在这里可以查询和修改关于人员,住房,收费和房产方面的信息,\n"+
"系统功能使用说明如下:\n"+
" 1。管理员有查询和修改两种权限,可从菜单选择所需的权限。\n"+
" 2。管理系统主要有人员管理,住房管理,收费管理,房产管理,帮助和\n"+
"返回六大主要菜单。管理员可根据所需功能进行选择。\n"+
" 3。人员,住房,收费和房产菜单下的查询功能是直接在对话框内输入\n"+
"select查询语句按确定按钮进行查询。\n"+
" 4。人员,住房,收费和房产菜单下的插入,修改和删除功能管理员要\n"+
"注意正确使用,并注意维护数据库中数据的一致。\n"+
" 5。查询结果和修改结果都在输出框内显示。\n"+
" 6。用户可通过帮助菜单选择帮助项得到有关管理系统使用的说明。\n";
jTextArea4.setText(s);
// Add your handling code here:
}//GEN-LAST:event_jMenuItem11ActionPerformed
private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu2ActionPerformed
// Add your handling code here:
}//GEN-LAST:event_jMenu2ActionPerformed
private void jMenuItem18ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem18ActionPerformed
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_jMenuItem18ActionPerformed
private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed
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 shoufei");
//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_jMenuItem9ActionPerformed
private void jMenuItem19ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem19ActionPerformed
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_jMenuItem19ActionPerformed
private void jMenuItem12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem12ActionPerformed
String input=null;
javax.swing.JFrame f=new javax.swing.JFrame();
input=javax.swing.JOptionPane.showInputDialog(f,"请输入Insert语句","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 ");
//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_jMenuItem12ActionPerformed
private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu1ActionPerformed
// Add your handling code here:
}//GEN-LAST:event_jMenu1ActionPerformed
private void jMenu7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu7ActionPerformed
// Add your handling code here:
}//GEN-LAST:event_jMenu7ActionPerformed
private void jMenu6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu6ActionPerformed
// Add your handling code here:
}//GEN-LAST:event_jMenu6ActionPerformed
private void jMenu3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu3ActionPerformed
// Add your handling code here:
}//GEN-LAST:event_jMenu3ActionPerformed
private void jMenuItem13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem13ActionPerformed
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 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("输入正确的Update语句.");
// Add your handling code here:
}//GEN-LAST:event_jMenuItem13ActionPerformed
private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem10ActionPerformed
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 shoufei");
//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_jMenuItem10ActionPerformed
private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed
String input=null;
javax.swing.JFrame f=new javax.swing.JFrame();
input=javax.swing.JOptionPane.showInputDialog(f,"请输入Insert语句","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 shoufei");
//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_jMenuItem8ActionPerformed
private void jMenuItem17ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem17ActionPerformed
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_jMenuItem17ActionPerformed
private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed
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 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("输入正确的Delete语句.");
// Add your handling code here:
}//GEN-LAST:event_jMenuItem7ActionPerformed
private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
String input=null;
javax.swing.JFrame f=new javax.swing.JFrame();
input=javax.swing.JOptionPane.showInputDialog(f,"请输入Insert语句","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("输入正确的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
}