ArtsQuery.java~5~
资源名称:Java.rar [点击查看]
上传用户:liming9091
上传日期:2014-10-27
资源大小:3376k
文件大小:4k
源码类别:
Java编程
开发平台:
Java
- package infomanagement;
- import java.awt.*;
- import javax.swing.*;
- import com.borland.jbcl.layout.*;
- import com.borland.dbswing.*;
- import com.borland.dx.sql.dataset.*;
- import com.borland.dx.dataset.*;
- import java.awt.event.*;
- /**
- * <p>Title: </p>
- * <p>Description: </p>
- * <p>Copyright: Copyright (c) 2003</p>
- * <p>Company: </p>
- * @author unascribed
- * @version 1.0
- */
- public class ArtsQuery extends JDialog {
- private JPanel jPanel1 = new JPanel();
- private XYLayout xYLayout1 = new XYLayout();
- private JLabel jLabel1 = new JLabel();
- private JLabel jLabel2 = new JLabel();
- private JLabel jLabel3 = new JLabel();
- private JTextField jTextField1 = new JTextField();
- private JButton jButton1 = new JButton();
- private JLabel jLabel4 = new JLabel();
- private JdbTable jdbTable1 = new JdbTable();
- private JLabel jLabel5 = new JLabel();
- private JButton jButton2 = new JButton();
- private JdbTextField jdbTextField1 = new JdbTextField();
- private QueryDataSet queryDataSet1 = new QueryDataSet();
- private Database database1 = new Database();
- private QueryDataSet queryDataSet2 = new QueryDataSet();
- public ArtsQuery(Frame frame, String title, boolean modal) {
- super(frame, title, modal);
- try {
- jbInit();
- pack();
- }
- catch(Exception ex) {
- ex.printStackTrace();
- }
- }
- public ArtsQuery() {
- this(null, "", false);
- }
- private void jbInit() throws Exception {
- jPanel1.setLayout(xYLayout1);
- jLabel1.setFont(new java.awt.Font("Dialog", 0, 23));
- jLabel1.setForeground(Color.magenta);
- jLabel1.setBorder(BorderFactory.createEtchedBorder());
- jLabel1.setText(" 文科科成绩查询");
- jLabel2.setBorder(BorderFactory.createEtchedBorder());
- jLabel3.setText("准考证号");
- jButton1.setText("执行查询");
- jButton1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- jButton1_actionPerformed(e);
- }
- });
- jLabel4.setBorder(BorderFactory.createEtchedBorder());
- jdbTable1.setBorder(BorderFactory.createEtchedBorder());
- jLabel5.setText("总成绩");
- jButton2.setText("退出");
- jButton2.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- jButton2_actionPerformed(e);
- }
- });
- database1.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor("jdbc:odbc:local", "sa", "", false, "sun.jdbc.odbc.JdbcOdbcDriver"));
- this.getContentPane().add(jPanel1, BorderLayout.CENTER);
- jPanel1.add(jLabel1, new XYConstraints(0, 1, 399, 53));
- jPanel1.add(jLabel3, new XYConstraints(10, 68, 90, 20));
- jPanel1.add(jTextField1, new XYConstraints(110, 68, 90, 20));
- jPanel1.add(jLabel2, new XYConstraints(0, 53, 398, 49));
- jPanel1.add(jButton1, new XYConstraints(290, 68, 90, 20));
- jPanel1.add(jdbTable1, new XYConstraints(1, 104, 394, 153));
- jPanel1.add(jLabel5, new XYConstraints(20, 270, 90, 20));
- jPanel1.add(jButton2, new XYConstraints(290, 270, 90, 20));
- jPanel1.add(jdbTextField1, new XYConstraints(110, 270, 90, 20));
- jPanel1.add(jLabel4, new XYConstraints(-2, 105, 397, 202));
- }
- void cancel(){
- dispose() ;
- }
- void jButton2_actionPerformed(ActionEvent e) {
- cancel() ;
- }
- void jButton1_actionPerformed(ActionEvent e) {
- try{
- int cardID = Integer.parseInt(jTextField1.getText().trim());
- queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "SELECT art2.cardID,art2.subject,art2.subjectNameID,art2.achievement " +
- "FROM info.dbo.art2 where science2.cardID='"+cardID+"'", null, true, Load.ALL));
- jdbTable1.setDataSet(queryDataSet1);
- queryDataSet2.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "SELECT SUM(achievement) AS SUM_achievement FROM info.dbo.art2 where science2.cardID='"+cardID+"'", null, true, Load.ALL));
- jdbTextField1.setColumnName("SUM_achievement");
- jdbTextField1.setDataSet(queryDataSet2);
- }
- catch(Exception www){}
- }
- }