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

📄 frame4.java.bak

📁 本系统是基于JBuilder和SQL2000开发的
💻 BAK
📖 第 1 页 / 共 3 页
字号:
           if(!rs4_2_1.next())
            {
               JOptionPane.showMessageDialog(this,"帐号或者密码错误","错误",JOptionPane.ERROR_MESSAGE);
            }
           else
             {
          try
             {
                String str4_2_3;
                str4_2_3=jTextField3.getText();
                Statement stmt4_2_2 = conn.createStatement(ResultSet.
                                                           TYPE_SCROLL_SENSITIVE,
                                                           ResultSet.CONCUR_UPDATABLE);
                String sq4_2_2 = "select * from book where 编号 = '"+str4_2_3+"'";
                ResultSet rs4_2_2 = stmt4_2_2.executeQuery(sq4_2_2);
                if(!rs4_2_2.next())
                  {
                    JOptionPane.showMessageDialog(this,"书籍编号错误","错误",JOptionPane.ERROR_MESSAGE);
                  }
                 else{
                         Statement stmt4_2_3 = conn.createStatement(ResultSet.
                                                                    TYPE_SCROLL_SENSITIVE,
                                                                    ResultSet.CONCUR_UPDATABLE);
                         String sq4_2_3 ="select 借阅情况 from book where 编号 = '"+str4_2_3+"'";
                         ResultSet rs4_2_3 = stmt4_2_3.executeQuery(sq4_2_3);
                         String a = new String("未借");
                         if ((rs4_2_3.next()) &&!rs4_2_3.getString("借阅情况").equals(a))
                         {
                             JOptionPane.showMessageDialog(this, "此书已借被借阅",
                                     "错误", JOptionPane.ERROR_MESSAGE);
                         }
                         else
                         {
                             Statement stmt4_2_4 = conn.createStatement(ResultSet.
                                                                        TYPE_SCROLL_SENSITIVE,
                                                                        ResultSet.CONCUR_UPDATABLE);
                         String sq4_2_4 ="select 已借书籍2 from reader where ID = '"+str4_2_1+"'";
                         ResultSet rs4_2_4 = stmt4_2_4.executeQuery(sq4_2_4);
                         String b = new String("未借");
                             if(rs4_2_4.next()&&!rs4_2_4.getString("已借书籍2").equals(b))
                             {
                                 JOptionPane.showMessageDialog(this, "此借书位已经不能借书,请尝试其他借书位",
                                         "错误", JOptionPane.ERROR_MESSAGE);
                             }
                          else
                          {
                              Statement stmt4_1_22 = conn.createStatement(ResultSet.
                                   TYPE_SCROLL_SENSITIVE,
                                   ResultSet.CONCUR_UPDATABLE);
            String sq4_1_22 = "select * from book where 编号 = '"+str4_2_3+"'";
            ResultSet rs4_1_22 = stmt4_1_22.executeQuery(sq4_1_22);
            if(rs4_1_22.next())

                                  { String rs1item1 = rs4_1_22.getString("编号");
                                       String rs1item2 = rs4_1_22.getString("书名");
                                       String rs1item3 = rs4_1_22.getString( "作者");
                                       String rs1item4 = rs4_1_22.getString("出版社");
                                       jTextArea1.setText("编号:       " +
                                               rs1item1 +
                                               '\n' +
                                               "书名:       " + rs1item2 + '\n' +
                                               "作者:       " + rs1item3 + '\n' +
                                               "出版社:       " + rs1item4 +
                                               '\n');

                                     JOptionPane.showMessageDialog(this,"请核对所借的书籍信息", "成功借书",JOptionPane.OK_CANCEL_OPTION);}
                               try{
                                    Statement stmt4_2_5 = conn.createStatement(ResultSet.
                                                                              TYPE_SCROLL_SENSITIVE,
                                                                              ResultSet.CONCUR_UPDATABLE);
                                    String sq4_2_5 ="update  reader  set 已借书籍2 = '已借'  where ID ='"+str4_2_1+"'";
                                    stmt4_2_5.executeUpdate(sq4_2_5);
                                    Statement stmt4_2_6 = conn.createStatement(ResultSet.
                                                                                    TYPE_SCROLL_SENSITIVE,
                                                                                    ResultSet.CONCUR_UPDATABLE);
                                    String sq4_2_6 ="update  book  set 借阅情况 = '送书' where 编号 ='"+str4_2_3+"'";
                                    stmt4_2_6.executeUpdate(sq4_2_6);
                                    Statement stmt4_2_7 = conn.createStatement(ResultSet.
                                                                                    TYPE_SCROLL_SENSITIVE,
                                                                                    ResultSet.CONCUR_UPDATABLE);
                                         String sq4_2_7 ="update  book  set 借书ID = '"+str4_2_1+"' where 编号 ='"+str4_2_3+"'";
                                         stmt4_2_7.executeUpdate(sq4_2_7);
                               }
                                 catch (Exception e)
                                            {
                                  System.err.println(e);
                                            }
                          }
                         }
                     }
                     }
                     catch(Exception e)
                        {
                 System.err.println(e);
                        }
                  }
              } catch(Exception e)
                               {
                                  System.err.println(e);
                               }
                 }//F4_2()
    public void jButton6_actionPerformed(ActionEvent e) {
               jTextArea1.setText("");
    }

    public void jButton3_actionPerformed(ActionEvent e) {
                 F4_3();
    }
    void F4_3(){
    try
        {
           String str4_3_1,str4_3_2;
           str4_3_1=jTextField1.getText();
           str4_3_2=new String(jPasswordField1.getPassword());
           Statement stmt4_3_1 = conn.createStatement(ResultSet.
                                              TYPE_SCROLL_SENSITIVE,
                                              ResultSet.CONCUR_UPDATABLE);
           String sq4_3_l= "select * from reader where ID='"+str4_3_1+"' AND 密码 = '"+str4_3_2+"' ";
           ResultSet rs4_3_1 = stmt4_3_1.executeQuery(sq4_3_l);
           if(!rs4_3_1.next())
            {
               JOptionPane.showMessageDialog(this,"帐号或者密码错误","错误",JOptionPane.ERROR_MESSAGE);
            }
           else
             {
          try
             {
                String str4_3_3;
                str4_3_3=jTextField4.getText();
                Statement stmt4_3_2 = conn.createStatement(ResultSet.
                                       TYPE_SCROLL_SENSITIVE,
                                       ResultSet.CONCUR_UPDATABLE);
                                    String sq4_3_2 = "select * from book where 编号 = '"+str4_3_3+"'";
                ResultSet rs4_3_2 = stmt4_3_2.executeQuery(sq4_3_2);
                if(!rs4_3_2.next())
                  {
                    JOptionPane.showMessageDialog(this,"书籍编号错误","错误",JOptionPane.ERROR_MESSAGE);
                  }
                 else{
                         Statement stmt4_3_3 = conn.createStatement(ResultSet.
                                                                   TYPE_SCROLL_SENSITIVE,
                                                                   ResultSet.CONCUR_UPDATABLE);
                         String sq4_3_3 ="select 借阅情况 from book where 编号 = '"+str4_3_3+"'";
                         ResultSet rs4_3_3 = stmt4_3_3.executeQuery(sq4_3_3);
                         String a = new String("未借");
                         if ((rs4_3_3.next()) &&!rs4_3_3.getString("借阅情况").equals(a))
                         {
                             JOptionPane.showMessageDialog(this, "此书已借被借阅","错误", JOptionPane.ERROR_MESSAGE);
                         }
                         else
                         {
                             Statement stmt4_3_4 = conn.createStatement(ResultSet.
                                                                        TYPE_SCROLL_SENSITIVE,
                                                                        ResultSet.CONCUR_UPDATABLE);
                         String sq4_3_4 ="select 已借书籍3 from reader where ID = '"+str4_3_1+"'";
                         ResultSet rs4_3_4 = stmt4_3_4.executeQuery(sq4_3_4);
                         String b = new String("未借");
                             if(rs4_3_4.next()&&!rs4_3_4.getString("已借书籍3").equals(b))
                             {
                                 JOptionPane.showMessageDialog(this, "此借书位已经不能借书,请尝试其他借书位","错误", JOptionPane.ERROR_MESSAGE);
                             }
                          else{
                              Statement stmt4_1_23 = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                                                                         ResultSet.CONCUR_UPDATABLE);
                            String sq4_1_23 = "select * from book where 编号 = '"+str4_3_3+"'";
                            ResultSet rs4_1_23 = stmt4_1_23.executeQuery(sq4_1_23);
                             if(rs4_1_23.next())
                               { String rs1item1 = rs4_1_23.getString("编号");
                                    String rs1item2 = rs4_1_23.getString("书名");
                                    String rs1item3 = rs4_1_23.getString( "作者");
                                    String rs1item4 = rs4_1_23.getString("出版社");
                                    jTextArea1.setText("编号:       " +
                                            rs1item1 +
                                            '\n' +
                                            "书名:       " + rs1item2 + '\n' +
                                            "作者:       " + rs1item3 + '\n' +
                                            "出版社:       " + rs1item4 +
                                            '\n');}
                                    JOptionPane.showMessageDialog(this,"请核对所借的书籍信息", "成功借书",JOptionPane.OK_CANCEL_OPTION);

                               try{
                                     Statement stmt4_3_5 = conn.createStatement(ResultSet.
                                                                                TYPE_SCROLL_SENSITIVE,
                                                                               ResultSet.CONCUR_UPDATABLE);
                            String sq4_3_5 ="update  reader  set 已借书籍3 = '已借'  where ID ='"+str4_3_1+"'";
                            stmt4_3_5.executeUpdate(sq4_3_5);
                                         Statement stmt4_3_6 = conn.createStatement(ResultSet.
                                                                                    TYPE_SCROLL_SENSITIVE,
                                                                                    ResultSet.CONCUR_UPDATABLE);
                                         String sq4_3_6 ="update  book  set 借阅情况 = '送书' where 编号 ='" +str4_3_3 + "'";
                                         stmt4_3_6.executeUpdate(sq4_3_6);
                                         Statement stmt4_3_7 = conn.createStatement(ResultSet.
                                                                                    TYPE_SCROLL_SENSITIVE,
                                                                                    ResultSet.CONCUR_UPDATABLE);
                                         String sq4_3_7 ="update  book  set 借书ID = '" +str4_3_1 + "' where 编号 ='" +str4_3_3 + "'";
                                         stmt4_3_7.executeUpdate(sq4_3_7);
                               }
                                 catch (Exception e)
                                            {
                                  System.err.println(e);
                                            }
                          }
                         }
                     }
                     }
                     catch(Exception e)
                        {
                 System.err.println(e);
                        }
                  }
              } catch(Exception e)
                               {
                                  System.err.println(e);
                               }
                 }//F4_3()

    public void jButton4_actionPerformed(ActionEvent e) {
      F4_4();
    }

    void F4_4(){
        try
            {
               String str4_4_1,str4_4_2;
               str4_4_1=jTextField1.getText();
               str4_4_2=new String(jPasswordField1.getPassword());
               Statement stmt4_4_1 = conn.createStatement(ResultSet.
                                                  TYPE_SCROLL_SENSITIVE,
                                                  ResultSet.CONCUR_UPDATABLE);
               String sq4_4_l= "select * from reader where ID='"+str4_4_1+"' AND 密码 = '"+str4_4_2+"' ";
               ResultSet rs4_4_1 = stmt4_4_1.executeQuery(sq4_4_l);
               if(!rs4_4_1.next())
                {
                   JOptionPane.showMessageDialog(this,"帐号或者密码错误","错误",JOptionPane.ERROR_MESSAGE);
                }
               else
                 {
              try
                 {
                    String str4_4_3;
                    str4_4_3=jTextField5.getText();
                    Statement stmt4_4_2 = conn.createStatement(ResultSet.
                                           TYPE_SCROLL_SENSITIVE,
                                           ResultSet.CONCUR_UPDATABLE);
                                        String sq4_4_2 = "select * from book where 编号 = '"+str4_4_3+"'";
                    ResultSet rs4_4_2 = stmt4_4_2.executeQuery(sq4_4_2);
                    if(!rs4_4_2.next())
                      {
                        JOptionPane.showMessageDialog(this,"书籍编号错误","错误",JOptionPane.ERROR_MESSAGE);
                      }
                     else{
                             Statement stmt4_4_3 = conn.createStatement(
                                     ResultSet.
                                     TYPE_SCROLL_SENSITIVE,
                                     ResultSet.CONCUR_UPDATABLE);
                             String sq4_4_3 ="select 借阅情况 from book where 编号 = '"+str4_4_3+"'";
                             ResultSet rs4_4_3 = stmt4_4_3.executeQuery(sq4_4_3);
                             String a = new String("未借");
                             if ((rs4_4_3.next()) &&!rs4_4_3.getString("借阅情况").equals(a))
                             {

⌨️ 快捷键说明

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