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

📄 4.借书界面.txt

📁 本系统是基于JBuilder和SQL2000开发的
💻 TXT
📖 第 1 页 / 共 4 页
字号:
                                             String sq4_1_5_1="select * from book where 编号='"+str4_1_3+"'";
                                             ResultSet rs4_1_5_1 = stmt4_1_5_1.executeQuery(sq4_1_5_1);
                                           if(rs4_1_5_1.next())
                                          {
                                              String bookName1 = rs4_1_5_1.
                                                      getString("书名");
                                              Statement stmt4_1_5 = conn.
                                                      createStatement(
                                                      ResultSet.
                                                      TYPE_SCROLL_SENSITIVE,
                                                      ResultSet.
                                                      CONCUR_UPDATABLE);
                                              String sq4_1_5 =
                                                      "update  reader  set 已借书籍 ='"+bookName1+"' where ID ='" +
                                                      str4_1_1 + "'";
                                              stmt4_1_5.executeUpdate(sq4_1_5);
                                              Statement stmt4_1_6 = conn.
                                                      createStatement(
                                                      ResultSet.
                                                      TYPE_SCROLL_SENSITIVE,
                                                      ResultSet.
                                                      CONCUR_UPDATABLE);
                                              String sq4_1_6 =
                                                      "update book set 借阅情况 = '送书' where 编号 ='" +
                                                      str4_1_3 + "'";
                                              stmt4_1_6.executeUpdate(sq4_1_6);
                                          }
                                               Statement stmt4_1_7 = conn.createStatement(ResultSet.
                                                                                          TYPE_SCROLL_SENSITIVE,
                                                                                          ResultSet.CONCUR_UPDATABLE);
                                                String sq4_1_7 ="update book set 借书ID = '" +str4_1_1 + "' where 编号 ='" + str4_1_3 + "'";
                                                stmt4_1_7.executeUpdate(sq4_1_7);
                                          }
                                            catch (Exception e)
                                                       {
                                             System.err.println(e);
                                                       }
                                     }
                                    }
                                }
                                }
                                catch(Exception e)
                                   {
                            System.err.println(e);
                                   }
                               }
                         } catch(Exception e)
                                          {
                                             System.err.println(e);
                                   }
                     }//F4_1()
    public void jButton2_actionPerformed(ActionEvent e)
    {
                    F4_2();
    }

    void F4_2()
    {
    try
        {
           String str4_2_1,str4_2_2;
           str4_2_1=jTextField1.getText();
           str4_2_2=new String(jPasswordField1.getPassword());
           Statement stmt4_2_1 = conn.createStatement(ResultSet.
                                                     TYPE_SCROLL_SENSITIVE,
                                                     ResultSet.CONCUR_UPDATABLE);
           String sq4_2_l= "select * from reader where ID='"+str4_2_1+"' AND 密码 = '"+str4_2_2+"' ";
           ResultSet rs4_2_1 = stmt4_2_1.executeQuery(sq4_2_l);
           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_1 = conn.createStatement(ResultSet.
                                  TYPE_SCROLL_SENSITIVE,
                                  ResultSet.CONCUR_UPDATABLE);
                                    String sq4_2_5_1="select * from book where 编号='"+str4_2_3+"'";
                                    ResultSet rs4_2_5_1 = stmt4_2_5_1.executeQuery(sq4_2_5_1);
                                    if(rs4_2_5_1.next())
                                    {String  bookName2 = rs4_2_5_1.getString("书名");
                                        Statement stmt4_2_5 = conn.
                                                createStatement(ResultSet.
                                                TYPE_SCROLL_SENSITIVE,
                                                ResultSet.CONCUR_UPDATABLE);
                                        String sq4_2_5 =
                                                "update  reader  set 已借书籍2 ='" +
                                                bookName2 + "' 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

⌨️ 快捷键说明

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