[Graduation in Computer Science] Design and implementation of library management system based on Java (source code + project report)

project description report

Library stack management system

The library management system mainly completes the librarian's management of books (book editing such as adding new books, deleting old books, and modifying them); the librarian's statistics on readers borrowing and returning books (the number of books in the library and the date of return) Statistics) and management; readers and administrators query book information and reader information; when the required information is found, print out corresponding information reports, etc.

During the design and implementation process of the library management system, I deeply realized the importance of this graduation project - it was an important exercise before I started working, and I deeply realized the theoretical The importance and necessity of contact practices. At the same time, I also feel the powerful functions of JAVA and SQL SERVER, as well as the flexibility and efficiency of event processing. But I am not very proficient in mastering and applying it, so I should practice more and practice more. In my future work, I will continue to learn and enrich myself, and strive to become a high-level programmer.

Java Swing; SQL Server;Book management ;Encyclopedia

Table of contents

Chapter 1 Introduction... 5

Chapter 2 User Requirements Specification... 6

2.1 Introduction to the document... 6

2.1.1 Purpose of documentation... 6

2.1.2 Scope of the document... 6

2.1.3 Audience target... 6

2.2 Product introduction... 6

2.3 User groups targeted by the product.. 7

2.4 Standards and specifications that products should comply with. .. 7

2.5 Functional requirements of the product... 7

2.5.1 Classification of functional requirements... 7

2.5.2 Features... 7

2.6 Non-functional requirements of the product.. 8

2.6.1 User interface requirements.. 8

2.6.2 Hard and soft environment requirements.. 8

2.6.3 Product quality requirements.. 8

Chapter 3 Architecture Design... 9

3.1 Introduction to the document... 9

3.1.1 Document purpose... 9

3.1.2 Document scope... 9

3.1.3 Audience target... 9

3.2 System Overview... 9

3.3 Design constraints... 10

3.4 Design strategy... 10

3.5 Overall system structure... 11

3.6 Structural functions of subsystems... 12

3.7 Configuration of development environment.. 19

3.8 Configuration of operating environment.. 19

Chapter 4 Database Design... 20

4.1 Document introduction... 20

4.1.1 Document purpose... 20

4.1.2 Document scope... 20

4.1.3 Audience target... 20

4.2 Database environment description.. 20

4.3 Naming rules of database... 21

4.4 Logic design... 22

4.5 Physical design... 22

4.5.1 Table summary... 22

4.5.2 Book collection order form... 23

4.5.3 Book borrowing record form... 23

4.5.4 Book information table... 23

4.5.5 Member table... 24

4.5.6 Book record table... 24

4.6 Safety design... 24

4.6.1 Methods to prevent users from directly operating the database.. 25

4.6.2 Roles and permissions... 25

4.7 Database management and maintenance instructions... 25

Chapter 5 User Interface Design... 26

5.1 Document introduction... 26

5.1.1 Document purpose... 26

5.1.2 Document Scope... 26

5.1.3 Audience target... 26

5.2 Interface design specifications that should be followed.. 26

5.3 Graphics of the interface... 26

5.4 Main interface... 27

 5.5 Procurement management system interface.. 27

5.6 Circulation system interface... 28

5.7 Query system interface... 28

5.8 Cataloging system interface... 29

Chapter 6 Module Design... 30

6.1 Document introduction... 30

6.1.1 Document purpose... 30

6.1.2 Document Scope... 30

6.1.3 Audience target... 30

6.2 Module naming rules... 30

6.3 Module summary... 30

6.3.1 Module summary table... 30

6.3.2 Module relationship diagram... 31

6.4 Module design... 32

6.4.1 Module design of procurement management system... 32

6.4.2 Module design of circulation management system... 32

6.4.3 Module design of query system... 33

6.4.4 Module design of cataloging system... 34

Chapter 7 Software Testing... 35

7.1 Goals of software testing.. 35

7.2 Software testing guidelines.. 35

7.3 Test methods... 35

7.4 Test steps... 35

7.5 For interface testing... 35

Chapter 8 Conclusion... 37

Acknowledgments... 38

References... 39

Appendix A Installation Instructions... 40

Appendix A.. 41

Chapter One Introduction

The construction of information campus is an important part of the construction of colleges and universities. It is a basic, long-term and regular work. Its construction level is an important symbol of the overall school running level, school image and status of colleges and universities. The development of information technology can be said to be rapid, but its application in education and teaching lags behind. In recent years, the campus informatization construction of various schools is in full swing. "Campus informatization management" has been mentioned a lot. However, judging from the current overall situation of colleges and universities across the country, most of them are still in the experimental stage. We are still in the experimental stage. Explore how to use these information technology methods to serve education and teaching more effectively. Compared with primary and secondary schools, universities have more and more professional talents, master more technology and information, and have more active thinking. They should be at the forefront of this road. How to introduce information technology into modern laboratory management has become a topic facing each of us.

As an exploration in library information management, we chose the development of "library information system" as our graduation project topic. Through this graduation thesis, I will review the design and development work during this period. This system basically meets the needs of users (schools) in library management and has a friendly user interface. The system effectively electronically processes user data, thereby reducing manual labor and increasing the accuracy of information.

Chapter 2 User Requirements Specification

2.1Introduction to the document

2.1.1 Purpose of documentation

         ​​​​In order to develop software products that truly meet user needs, we must first know the user's needs. An in-depth understanding of software requirements is a prerequisite for successful software development. No matter how well we do our design and coding work, programs that cannot truly meet user needs will only disappoint users and cause trouble to developers. Requirements analysis is a starting stage of development, and its basic task is to accurately answer the question "What must the system do?"

2.1.2 Scope of the document

         The task of requirements analysis is to put forward complete, accurate, clear and specific requirements for the target system. Before the requirements analysis phase ends, the system analyst should write a software requirements specification to accurately describe the software requirements in written form.

2.1.3 Audience target

         The user requirements document is a platform for customers to participate in the communication between designers. Customers can watch the requirements document to understand what the software they want is like. Designers can also design the software according to their needs. Therefore, This document is intended primarily for clients and designers.  

2.2Product service details

(1) This product is a library management system and software for managing book stacks. This system brings great convenience to administrators. It can realize some functions such as adding and deleting books to the library, and can also complete operations such as borrowing and returning books.

(2) The development of this product mainly includes the establishment and maintenance of the back-end database and the development of front-end applications. The front-end program is mainly developed using JAVA, and the back-end database is mainly developed using SQL SERVER 2000.

2.3User groups targeted by the product

(1) This is software specially designed for managing libraries, so the customers of this product are mainly people engaged in library management. This software has a friendly interface and is simple and easy to operate. Users do not need a high level of knowledge to complete the operation.

(2) This product has good operability, simple operation and complete functions, which greatly improves work efficiency and saves costs.

2.4Standards and specifications that products should comply with.

(1) Code comment specifications.

(2) Read national regulations.

(3) Interface design specifications.

2.5Functional requirements of the product

2.5.1 Classification of functional requirements

Table 2.1 Functional requirements classification table

Functional category

Subfunction

Procurement management system

Order textbooks

cancel the order

Circulation management system

Borrow books

Return the book

Get books

Query system

Check borrowing records

Find books

cataloging system

New book number

Update books

2.5.2 Features

     The library management system can be divided into four subsystems: procurement management system, circulation management system, query system, and cataloging system. The procurement system is responsible for purchasing books, the circulation system is mainly responsible for borrowing and returning books, etc., the query system is for searching books, etc., and the cataloging system is for cataloging new books.

2.6Non-functional requirements of the product

2.6.1 User interface requirements

Table 2.2 User interface requirements table

Requirement name

Detailed requirements

Borrow books

Borrow books and register them in the system

Return the book

Return the book, the system checks the borrowing record and deletes the borrowing record

Inquire

Search for books or records

catalog

Number new books, or update the catalog

purchase

Make a book order

2.6.2 Hard and soft environment requirements

Table 2.3 Software and hardware environment requirements table

Requirement name

Detailed requirements

CPU

P2 or higher

Memory

64M or more

space

800M or more

operating system

98 or above

2.6.3 Product quality requirements

Table 2.4 Product quality requirements table

Main quality attributes

Detailed requirements

correctness

The results of the specified operations can be displayed correctly;

Robustness

The functions are complete, that is, they can meet all the needs of ordinary users;

reliability

The software runs stably and is not prone to abnormal loss of information;

performance,efficiency

Short reaction time;

Ease of use

easy and good;

clarity

Friendly interface for analysis;

safety

Password is encrypted

Scalability

This software adopts a modular design. When you need to expand functions, you only need to write modules that meet the corresponding functions and connect them to the software interface. It has strong scalability;

compatibility

It has no impact on other software in the system and has strong compatibility;

portability

It can run normally on any series of machines without making any changes, and has strong portability;

Chapter 3 Architecture Design

3.1Interview text

3.1.1 Document Purpose

     Architecture design is the second stage of software design. The main work at this stage is to design a rough model of the system, design some main functions, draw functional structure diagrams and program flow charts, and then make modifications according to needs, and finally realize the entire system function.

3.1.2 Document Scope

     This document involves the design of the architecture. The architecture is to determine which modules each program in the system is composed of and the relationship between these modules. There are function diagrams and program diagrams, which can be read by both users and designers.

3.1.3 Audience target

     Function diagrams and program diagrams are easy to understand, and customers can understand the general functions of the system. If they are not satisfied with the system, they can give feedback directly to the designer and then make modifications until the customer is satisfied.

3.2System Overview

   (1) The library management system is a typical information management system (MIS). Its development mainly includes the establishment and maintenance of the back-end database and the development of front-end applications. For the former, it is required to establish a library with strong data consistency and integrity and good data security. For the latter, the application is required to be fully functional and easy to use. Therefore, combined with the requirements of the open-access library, I conducted a more in-depth study and application of the SQL Server2000 database management system, SQL language principles, and JAVA SWING technology.

   (2) This system is divided into four subsystems based on functions: procurement, circulation, inquiry, and cataloging. These functions are all implemented through the database, and they all have similar functions such as deletion and addition.

3.3Design promise

Software and hardware environment requirements:

Table 3.1 Design constraints of software and hardware

Requirement name

Detailed requirements

CPU

P2 or higher

Memory

64M or more

space

800M or more

operating system

98 or above

user interface:

Table 3.2 User interface design constraints

Requirement name

Detailed requirements

Borrow books

Borrow books and register them in the system

Return the book

Return the book, the system checks the borrowing record and deletes the borrowing record

Inquire

Search for books or records

catalog

Number new books, or update the catalog

purchase

Make a book order

Software quality constraints:

Table 3.3 Constraints on software quality

Main quality attributes

Detailed requirements

correctness

The results of the specified operations can be displayed correctly;

Robustness

The functions are complete, that is, they can meet all the needs of ordinary users;

reliability

The software runs stably and is not prone to abnormal loss of information;

performance,efficiency

Short reaction time;

Ease of use

easy and good;

clarity

Friendly interface for analysis;

safety

Password is encrypted

Scalability

This software adopts a modular design. When you need to expand functions, you only need to write modules that meet the corresponding functions and connect them to the software interface. It has strong scalability;

compatibility

It has no impact on other software in the system and has strong compatibility;

portability

It can run normally on any series of machines without making any changes, and has strong portability;

3.4Design Strategy

   Expansion strategy: Modularization is to divide the program into independently named and independently accessible modules. Each module completes a sub-function. These modules are integrated to form a whole that can complete specified functions to meet user needs. Modularity is the only attribute that components should have in order to make a complex large-scale program manageable by human intelligence. If a large program consists of only one module, it will be difficult to understand. Adopting the modular principle can make the software structure clear, which is not only easy to design but also easy to read and understand. Because program errors are usually localized to related modules and the interfaces between them, modularization makes software easier to test and debug, thereby helping to improve software reliability. Because changes often involve only a few modules, modularization can improve the modifiability of software. Modularization also helps in the organization and management of software development projects. A complex large program can be divided into different modules by many programmers, and skilled programmers can be further assigned to write difficult modules.

3.5System structure structure

(1) This system is decomposed into four subsystems: procurement management system, circulation management system, query system, and cataloging system.

1) The purchasing management system is a system that specializes in purchasing management operations. When students or teachers want to order books through the school, the user can enter a series of ordering information to generate an electronic order, and the school will help the students or teachers order according to the order. books.

2) The circulation management system is the management operation of the three processes of borrowing, returning, and taking books. These three processes are the basic operations of library managers. You need to be a member to borrow books, and you need an order form to pick up books.

3) The query system is an operation to search for some book information. When a new book is put into the database, the information about the new book will be stored in the database. Since there are many books, it is difficult to find books, so the books are classified when they are put into the database to facilitate search.

4) The cataloging system is a book management operation. When new books are put into the library, the new book cataloging function is used to catalog them, classify the books, and assign an ISBN to each book; updating books is to update the books that have been put into the library, which only changes the Basic information such as subject categories.

The following is the system function structure diagram:

Usually a module in a program performs an appropriate sub-function. Modules should be organized into a good hierarchical system. The top-level module calls its lower-level modules to realize the complete function of the program. Each lower-level module then calls a lower-level module to complete a sub-function of the program. The lowest-level module completes the most specific function. function. The function diagram is roughly divided into three layers. The top part of the function diagram is the largest functional module, the next one is the subsystem functional module, and the next one is the smallest sub-module.

Figure 3.1 System structure and function diagram

(2) Therefore, this system adopts a modular design, and each module is independently accessible. When modifications or changes are to be made, this often only involves a few modules. This not only improves the modifiability, but also helps Organizational management of software development projects.

(3) Pursue loose coupling as much as possible in system design. In such a system, any module can be researched, tested or maintained without knowing much about other modules of the system. At the same time, we also strive to achieve high cohesion. Cohesion marks how closely each element within a module is combined with each other. It is a natural extension of the concepts of information hiding and localization. Simply put, ideally cohesive modules do only one thing. This system has low coupling and high cohesion. The two modules exchange information with each other through parameters, and the information exchanged is only data, and the relationship between the modules is very loose. In this way, we can complete the entire system and realize the functions from the part to the whole.

3.6Structure functions of subsystems

(1) The procurement management system is divided into two sub-modules: ordering and cancellation of ordering.

Ordering module: This module is mainly used to implement the function of ordering books. You must enter your membership information before ordering books. If you are not a member, you cannot order.

Cancel order: This module mainly implements the order cancellation function. If the customer wants to cancel the ordered books, they must enter the order number, check the order number first, and then use the function of deleting the order.

Order flow chart:

Figure 3.2 Ordering flow chart

Flow chart description: To order books, the ordering customer must first be a member of this system. Only after entering the membership number to confirm that it is correct can the order be made. Then enter some basic ordering information. This information will be typed into an electronic order and recorded in the database. Here, there will be a message prompt when the order is completed, and it is over.

Cancel order flow chart:

Figure 3.3 Cancel order flow chart

    Flow chart description: After you order a book, if you are not satisfied, you can change or cancel the order according to the order. When you enter the order number, your order information will be displayed, and then you can modify or cancel it directly based on the information. Finish.

(2) The circulation management system is divided into three modules: borrowing books, returning books, and receiving books.

借书模块:这个模块主要是实现借书功能。这个功能只有是会员才能使用,要进行借书操作需要输入会员号码。其它就是输入借书的的信息。

还书模块:这个模块主要是实现还书功能。

领取书籍:这个模块主要是实现领取书籍功能。领书是要根据订单来领书,领书

首先要输入订单号,才能进一步实现。

借书流程图:

图3.4 借书流程图

流程图说明:借书要先输入会员号码,如果是会员就可以进行书籍信息输入,输入你要借的书籍的相关信息,满足信息要求就能借用书籍。如果不是,就会跳出提示信息,提示号码不正确,就不能进行信息书籍输入,结束。

还书流程图:

图3.5 还书流程图

   流程图说明:还书要先输入你借的书的书号,正确的话就会显示出书籍的借用时期,还有书的作者等信息,结束。

领取书籍流程图:

图3.6 领取书籍流程图

流程图说明:领取书籍先输入订单号,核对过后再进行订购信息核对,正确的话就领书,结束。

(3)查询系统分为两个模块:查找书籍、查询记录。

查找书籍:为了方便读者找书和管理员管理书籍,设计了书籍查找功能。输入书名就能阅读书籍的相关信息。

查询记录:为了了解书籍的借阅情况,可用此功能查找书籍的借书记录。

查找书籍流程图:

图3..7 查找书籍流程图

    流程图说明:先输入会员号码,成功就能进行书籍查找,输入书名,查找到的结果会在文本框中显示,继续则返回到输入书名号,否则结束。

查询记录流程图:

图3.8 查询记录流程图

(4)编目系统分为两个模块:新书编号,更新书籍。

新书编号:新书进库前要进行书籍信息资料登记,并进行书籍分类,新书籍的有关信息都可在这里找到。

更新书籍:书籍的记录信息有误的话,在这里可进行修改。

新书编号流程图:

图3.9 新书编号流程图

更新书籍流程图:

图3.10 更新书籍流程图

流程图说明:先输入书号,有此书就会显示出书籍的信息,没有就会回到书号输入状态。成功显示信息后直接进行修改,书库就重新记录书籍信息,结束。

3.7开发环境的配置

表3.4 开发环境配置表

类别

标准配置

最低配置

计算机硬件

CPU1.7Hz

CPU800M以上

内存128M

内存64M以上

硬盘空间20G

硬盘空间10G

软件

操作系统2000

操作系统98以上

JDK1.4.2

JDK1.4.1以上

网络通信

3.8运行环境的配置

表3.5 运行环境配置表

类别

标准配置

最低配置

计算机硬件

CPU1.7Hz

CPU800M以上

内存128M

内存64M以上

硬盘空间20G

硬盘空间10G

软件

操作系统2000

操作系统98以上

JDK1.4.2

JDK1.4.1以上

网络通信

第四章 数据库设计

4.1文档介绍

4.1.1文档目的

      从使用者角度看,信息系统是提供信息、辅助人们对环境进行控制和进行决策的系统。数据库是信息系统的核心和基础。它把信息系统中大量的数据按一定的模型组织起来,提供存储、维护、检索数据的功能,使信息系统可以方便、及时、准确地从数据库中获得所需的信息。一个信息系统的各个部分能否紧密地结合在一起以及如何结合,关键在数据库。因此只有对数据库进行合理的逻辑设计和有效的物理设计才能开发出完善而高效的信息系统。数据库设计是信息系统开发和建设的重要组成部分。

4.1.2文档范围

      数据库设计是整个系统的重要组成部分,是系统的核心,一般用户只有一般的操作权限,如添加、删除等普通操作,只有数据库管理人员才有权限进行更多的操作。

4.1.3读者对象

     数据库是很一个系统很重要的部分,里面都是存放了很多信息,一般只有高级管理员才能直接使用数据库。用户只能通过界面才能进行一般的数据库操作。

4.2数据库环境说明

人们在总结信息资源开发、管理和服务的各种手段时,认为最有效的是数据库技术。数据库的应用已越来越广泛。从小型的单项事务处理系统到大型复杂的信息系统大都用先进的数据库技术来保持系统数据的整体性、完整性和共享性。目前,一个国学的数据库建设规模、数据库信息量的大小和使用频度已成为衡量这个国家信息化程度的重要标志之一。数据库设计是建立数据库及其应用系统的技术,是信息系统开发和建设中的核心技术,具体说,数据库设计是指对于一个给定的应用环境,构造最优的数据库模式,建立数据库及其应用系统,使之能够有效地存储数据,满足各种用户的应用需求。

数据库系统采用了SQL SERVER 2000进行数据库设计,下面是基本的硬件情况:

   处理器速度为1.7GHz;

   内存256M

硬盘空间:60G

   SQL Server 2000典型安装

软件情况:操作系统Windows 2000 Server

4.3数据库的命名规则

数据文件命名采用系统名+_+文件类型,比如系统名为Library,则数据库文件命名为Library_database.mdf,有的数据库文件有多个,比如SQL Server就有2个,一个是数据库文件,另一个是日志文件,那么他们的文件命名分别为Library_database.mdf,Library_log.log。文件名全部采用小写。

数据库表命名规范,表名长度不能超过30个字符,表名中含有单词全部采用单数形式,单词首写字母要大写,多个单词间不用任何连接符号。若库中有多个系统,表名采用系统名称+单词或多个单词,系统名是开发系统的缩写,系统名称全部采用小写英文字符,如libTitle,libForumType。若库中只含有一个系统,那么表名仅用一个单词或多个单词。单词选择能够概括表内容的一个或多个英文单词,如UserInfo,UserType。关联表命名规则为Re_表A_表B,Re是Relative的缩写,如:Re_User_ArticleType, Re_User_FormType。

数据库字段命名规范,数据库字段名全部采用小写英文单词,单词之间用”_”隔开,命名规则是表别名+单词,如:user_name,user_pwd。表别名规则,如果表名是一个单词,别名就取单词的前4个字母;如果表名是两个单词,就各取两个单词的前两个字母组成4个字母长的别名;如果表的名字由3个单词组成,你不妨从头两个单词中各取一个然后从最后一个单词中再取出两个字母,结果还是组成4 字母长的别名。

视图名采用规则View_表A_表B_表C,View表示视图。这个视图由几个表产生就用”_”连接几个表的名,如果表过多可以将表名适当简化,但一定要列出所有表名。

存储过程命名规则P_表名_存取过程名(缩写),比如P_User_Del,P_ArticleType_AddData。

SQL语句编写规则,关键字必须大写,其他书写按上述命名规则,比如:

 SELECT user_id, user_name FROM User WHERE user_id = ‘tom’

4.4逻辑设计

数据库的ER图::

图6.1  ER图

Library(Category,Quantity,BooksID,BookName,Author,Edition,Storetime)

Member(MembersID,StudentName,Class,StudentNumber)

List(ListNumber,BookName,Author,Edition,Quantity,Bookdate,MembersID)

BorrowRecord(RecordNumber,BooksID,MembersID,Borrowdate,Author,

Edition,BookName)

BookRecord(Storetime,Borrowtime,BookName,MembersID,StudentName)

4.5物理设计

4.5.1表总汇

表6.1 总表

表名

功能说明

领书订单表

根据订单领取书籍

借书记录表

记录借书的信息

书籍信息表

书库里的书籍信息

        会员表

会员信息

书籍记录表

书籍的历史记录

4.5.2领书订单表

表6.2 订单表

表名

领书订单(List)

列名

数据类型(精度范围)

/非空

约束条件

ListNumber

int

非空

主键

MembersID

Int

非空

主键

BookName

varchar

没有

Author

varchar

没有

Edition

varchar

没有

Quantity

varchar

没有

Bookdate

datetime

没有

补充说明

4.5.3借书记录表

表6.3 借书记录表

表名

借书记录(BorrowRecord)

列名

数据类型(精度范围)

/非空

约束条件

RecordNumber

int

非空

主键

BooksID

int

非空

主键

MembersID

int

非空

主键

Borrowdate

varchar

没有

Author

varchar

没有

Edition

varchar

没有

BookName

datetime

没有

补充说明

4.5.4书籍信息表

表6.4 书籍信息表

表名

书籍信息(Library)

列名

数据类型(精度范围)

/非空

约束条件

Category

varchar

没有

Quantity

int

没有

BooksID

int

非空

主键

BookName

varchar

没有

Author

varchar

没有

Edition

varchar

没有

Storetime

datetime

没有

补充说明

4.5.5会员表

表6.5 会员表

表名

会员(Member)

列名

数据类型(精度范围)

/非空

约束条件

MembersID

int

非空

主键

StudentName

varchar

没有

Class

varchar

没有

StudentNumber

int

没有

补充说明

4.5.6书籍记录表

表6.6 书籍记录表

表名

书籍信息记录(BookRecord)

列名

数据类型(精度范围)

/非空

约束条件

Storetime

datetime

没有

Borrowtime

datetime

没有

BookName

varchar

没有

MembersID

int

非空

主键

StudentName

varchar

没有

补充说明

4.6安全性设计

系统设置有多级安全控制,即:网络安全级、数据库安全级和用户安全级。即采用网络登录验证、数据库使用权限验证、应用系统使用验证三种验证方式相结合的方式验证用户。为保证数据传输的安全性,使所传输的数据不被盗窃、更改,应用系统所采集的重要原始数据可采用网络加密传输、数据加密传输或应用系统数据加密相结合的技术。运用日志,对进入系统的用户的操作进行记录,可以根据日志进行事后分析,从而找到事故的发生原因、责任者。当系统需要检修或维修时,有可能对系统进行调试,在调试时将采用切换到临时运行环境(临时数据库)的方法,使系统在调试时与正式存储设备(数据库)隔离,维修结束正式使用时,再将系统与正式存储设备(数据库)相连接。这样就可以保证系统在维修时原有数据的安全。

4.6.1防止用户直接操作数据库的方法

一般管理员只能通过账号登陆到应用软件,通过应用软件访问数据库,高级管理员通过数据库账号来管理和维护数据库,这个DBA账号只有高级管理员才有,一般的用户不能使用。

4.6.2角色与权限

一般用户具有添加、删除、更新、增加等权限;高级管理员具有最高管理权,能够对数据库的所有东西进行操作;会员具有查权限。

4.7数据库管理与维护说明

1.数据库的转储与恢复

2.数据库的安全性、完整性控制

3.数据库性能的监督,分析和改造

4.数据库的重组织与重构造

第五章 用户界面设计

5.1文档介绍

5.1.1文档目的

     用户界面是系统与客户直接进行交流的平台,用户界面的好坏是成败的关键。友好的界面能让客户操作起来觉得简单易用,不好的界面功能再好也不易让客户接受。

5.1.2文档范围

     本文档是模块设计的功能实现,是用户的直接想要的东西,给用户进行测试,然后设计者再进行修改。

5.1.3读者对象

    对象是用户和管理员。

5.2应当遵循的界面设计规范

1)用户原则。人机界面设计首先要确立用户类型。划分类型可以从不同的角度,视实际情况而定。确定类型后要针对其特点预测他们对不同界面的反应。这就要从多方面设计分析。
2)信息最小量原则。人机界面设计要尽量减少用户记忆负担,采用有助于记忆的设计方案。
3)帮助和提示原则。要对用户的操作命令作出反应,帮助用户处理问题。系统要设计有恢复出错现场的能力,在系统内部处理工作要有提示,尽量把主动权让给用户。

5.3界面的图形

主界面图书馆书库管理系统

子系统A界面:订购,取消订购;

子系统B界面:借书,还书,领取书籍;

子系统C界面:查找书籍,查找记录;

子系统D界面:新书编目,更新书籍,增加会员;

5.4主界面

图5.1 主界面图

 5.5采购管理系统界面

图5.2 订购图

5.3 取消订购

5.6流通系统界面

图5.4 借书界面图                                图5.5 还书界面图                  

                           图5.6 领书界面图

5.7查询系统界面

     图5.7 查询书籍界面                          图5.8 查房记录界面

5.8编目系统界面

                              图5.9 新书编目界面图

           图5.10更新书籍界面图                     图5.11会员注册界面图

第六章 模块设计

6.1文档介绍

6.1.1文档目的

     模块化设计是把一个整体划分为几个局部,而这些局部又可能可以再划分为更小的局部,这些局部就是模块,当我们开发具有独立功能而且和其他模块之间没有过多的相互作用的模块,就可以做到模块独立。换句话说,希望这样设计软件结构,使得每个模块完成一个相对独立的特定子功能,并且和其他模块之间的关系很简单。

6.1.2文档范围

     模块化设计是一种结构化的设计,是程序内部的具体功能设计。

6.1.3读者对象

     对象是设计代码的工作者。

6.2模块命名规则

     模块的命名规则是根据模块的功能和类的来命名的。如借书模块,显然这个模块是实现学生或老师向图书馆借书的功能。

6.3模块总汇

6.3.1模块总汇表

表6.1 子系统表

子系统(采购管理系统)

模块名称

功能简述

订购

是学生和老师订购书籍的功能

取消订购

取消书籍订购

子系统(流通管理系统)

模块名称

功能简述

借书

学生借书功能

还书

学生还书功能

领取书籍

领取订购的书籍

表6.2 子系统表

子系统(查询系统)

模块名称

功能简述

查找书籍

查找书籍的信息

查找记录

查找书籍记录

子系统(编目系统)

模块名称

功能简述

新书编目

把新到的书编入书库

更新书籍

修改书籍的存档

6.3.2模块关系图

图6.1 模块关系图

6.4模块设计

6.4.1采购管理系统的模块设计

订购模块:

模块名称

订购

功能描述

图书馆帮学生或老师订购书籍。

具体实现

订购功能是一般的用户操作,客户要进行订购,就必须成为本系统的会员,注册会员并得到会员号码,在对应的文本框里输入会员号码和订购信息,确定后,如果会员号码错误,就会跳出错误提示对话框,然后要求客户重新输入会员号信息;如果会员号信息正确的话就会跳出订购成功信息对话框,所有订购信息将会记录入数据库。这时数据库就会产生出订单号,客户根据订单号再进行下面的领书程序。

具体代码

见附录

取消订购模块:

模块名称

取消或更改订购

功能描述

客户要更改订购书籍的信息或取消订购单

具体实现

要更改订购书籍信息时,客户要拿出订购单,输入订单号,经系统核对之后,如果正确就能在显示出本订单的订购书籍的信息,如果错误就会弹出错误提示对话框,要求你重新输入订单号或退出本操作。当你的订单号正确的时候,你就要在信息框里直接进行信息修改,再点击确认。信息就会重新入库,但订单号不变。

具体代码

见附录

6.4.2流通管理系统的模块设计

借书模块:

模块名称

借书

功能描述

学生或老师向图书馆借阅书籍

具体实现

借书要使用现会员号码,在借书前要先输入会员号,经验证正确后,下面的文框才能进行书籍信息输入,如果你要借的书给人借走了,系统就会提示此书已出借的信息提示,如果书库有此书籍,就会提示成功的消息。但输入的借书信息必须要完整,不然就会出现错误提示。成功后借书的信息记录就会进入数据库里。

具体代码

见附录

还书模块

模块名称

还书

功能描述

学生或老师向图书馆还书籍

具体实现

还书要先输入你借的书的书号,经系统查询记录后,就会显示出你借的这本书的一些相关信息。书号输入不正确时,就会有错误消息弹出,正确就会在下面的文本框里显示出借书人的姓名、借书时期等信息。还书成功后就会进入数据库,删除以前的借书记录。

具体代码

见附录


领取书籍模块:

模块名称

领书

功能描述

学生或老师根据订单向图书馆领取书籍

具体实现

先输入订单号,查找出此订单的订购信息,订单正确的话就会列出一系统订购信息,否则,系统会提示你的订单号不存在或者订单号输入错误。如果客户确认订单信息正确的话,就进行领书操作,成功后原订单信息就直接删除掉。

具体代码

见附录

6.4.3查询系统的模块设计

查询书籍模块:

模块名称

查询书籍

功能描述

学生或老师向图书馆还书籍

具体实现

查找书就只要输入书名即可,系统就会在数据库里的书库表里查找此书的信息,如果书库里没有此书的话,就会显示出查找失败的消息或提示没有此书。成功查找到的话就会在下面的文本区域里显示出书籍的相关信息。

具体代码

见附录

查找记录模块:

模块名称

查询记录

功能描述

图书馆管理员查找书籍的借用情况

具体实现

把书籍的书名输入文本框,点击查询就能在数据库里进行查找,就可以显示出借书人的姓名、会员号、借书日期,书号等信息。

具体代码

见附录

6.4.4编目系统的模块设计

新书编目模块:

模块名称

新书编目

功能描述

图书馆管理员把新来的书进行入库编号

具体实现

先要了解此书是属于哪类的书籍、书名、作者、出版社,再进行书籍编目信息的输入。

书籍资料全部输入之后,点击添加书籍后,书籍资料就会进行数据库中的表。成功的话就会提示成功信息。之后此书籍就会产生出书号。

具体代码

见附录

更新书籍模块:

模块名称

查询记录

功能描述

图书馆管理员查找书籍的借用情况

具体实现

把此书的书号输入并查询,就能查看到此书的入库资料,要更改信息,只要直接在信息栏上面修改即可,更改确认后书籍信息重新入库。但书籍号仍然不变。

具体代码

见附录

会员模块:

模块名称

会员

功能描述

注册会员号

具体实现

客户要注册会员号才能有一定的权限,注册为会员要输入你的姓名跟班级、学号。会员号是系统产生的,因此客户要记住自己的会员号。

具体代码

见附录

第七章 软件测试

7.1软件测试的目标

   (1)制定程序测试方案

(2)利用测试方案找到程序的错误

(3)发现到今尚未发现的错误

7.2软件测试准则

  (1)所有测试都应该能追溯到用户需求

  (2)应该远在测试开始之前就制定出测试计划

  (3)应该从“小规模”测试开始,并逐步进行“大规模”测试。

  (4)为了达到最佳的测试效果,应该由独立的第三方从事测试工作。

7.3测试方法

   测试任何产品都有两种方法:黑盒测试和白盒测试。

7.4测试步骤

   (1)模块测试

   (2)子系统测试

   (3)系统测试

   (4)验收测试

   (5)平行运行

7.5接口测试用

模块:订购

输入/动作

期望的输出/相应

实际情况

输入会员号码

核对会员号,实现登陆操作

相同

输入没有注册的号码

核对后输出错误的提示

相同

模块:取消订购

输入/动作

期望的输出/相应

实际情况

输入订单号

显示出订单信息

输入没有的订单号

显示出订单错误的信息提示

模块:借书

输入/动作

期望的输出/相应

实际情况

输入会员号码

能够进行借书的操作

相同

输入没有注册的号码

核对后输出错误的提示,不能进行借书操作

相同

模块:还书

输入/动作

期望的输出/相应

实际情况

输入书号

显示出借书的信息记录

相同

输入错误的书号

显示出书号错误的信息提示

相同

模块:领书

输入/动作

期望的输出/相应

实际情况

输入订单号

显示出订单的信息

相同

输入错误的订单号

核对后输出错误的提示

相同

模块:查找书籍

输入/动作

期望的输出/相应

实际情况

输入书名

能够显示出书的信息

相同

输入书库里没有的书名

显示没有此书

相同

模块:查找记录

输入/动作

期望的输出/相应

实际情况

输入书号

显示此书的借书记录

相同

输入错误的书号

显示出没有此书的借书记录

相同

模块:新书编号

输入/动作

期望的输出/相应

实际情况

输入新书的相关关信息

新书入库

相同

输入新书的信息不全

显示出信息不足

相同

模块:更新书籍

输入/动作

期望的输出/相应

实际情况

输入书号

显示该书的信息

相同

输入错误的书号

显示出没有此书的提示

相同

第八章 结论

图书馆书库管理系统是一个以计算机为工具,对图书馆管理信息进行处理的人——机系统,它能准确、及时地反映图书馆当前书籍信息状态,能利用过去的数据统计分析,能从全局出发辅助图书馆管理人员管理图书馆书籍。可见,工商管理系统首先必须具有强大的电子数据处理功能,能大大提高学校管理人员的工作效率,减轻劳动强度,同时,该系统应当采用管理模型,将仿真、优化等现代决策手段结合起来,为学校管理层的决策提供有效信息。通过这次设计我除了在程序设计水平和数据库应用能力上有了很大程度的提高,也更加深入了理解了JAVA SWING 和SQL SERVER 2000设计中常见问题和的其设计的意义。

由于设计此类系统经验不足,时间有限,尤其是对图书馆管理流程的认识不足,虽然目前顺利完成了系统的调研、分析、设计和调试的工作,但是仍然有许多不足之处,我们会在将来的软件设计过程中引以为戒。

致谢

首先,我要衷心感谢我的所有教学老师。在我攻读学士学位的四年期间,他们在学习上对我严格要求,在生活上对我关怀备至。其中特别要感谢老师,他在毕业论文上给予我精心而有效的指导,使我顺利的结束了大学里的最后一堂课,所有一切将永远留在我的记忆中。

感谢我的导师对我的指导和关怀。一直以来,刘老师不遗余力地为我创造了许多学习和实践的机会。他的悉心指导不仅使我的专业技能水平得到了提高而且使我的抽象思维能力和表达能力大大提高。刘老师不但具有渊博的知识和很高的治学水平,他崇高的道德情操更是我们学习的榜样。

同时也为我以后的学习和工作生涯打下了坚实的基础。

其次,我要感谢和我同课题的同学及其他帮助过我的人,他们给予我所需要的资料,必要时给予我鼓励。我所取得的成绩与他们的帮助是分不开的。我也十分感谢我周围的同学。他们在学术上给予我有益的帮助和启发,使我获益非浅。

最后,我要感谢我的父母、亲友,是他们一直在支持我、鼓励我,使我能够顺利地完成学业。

参考文献

[1] 张海藩. 软件工程导论(第四版). 北京:清华大学出版社,2003.

[2] 耿祥义,张跃平. Java2实用教程(修订). 北京:清华大学出版社,2001

[3]萨师煊,王珊. 数据库系统概论(第三版). 北京:高等教育出版社,2004

[4]Rob Hawthorne. SQL SERVER 2000从零开始(第一版). 北京:人民邮电出版社,2001

附录A 安装说明

1.安装j2sdk1.4.2_04

把本软件安装电脑C盘上,安装成功后点击我的电脑,进行环境变量的设置,新建环境变量,变量名输入:path。变量值输入:你安装的JDK的路径

再打开DOS,在C盘符上输入set path=你安装的JDK的路径。回车即可

打入javac就会出一大堆帮助,那就表示安装成功。

2.安装SQL Server 2000

把本软件安装在电脑C盘上,在安装过程中关键是设置管理账号。安装好之后要导入数据,数据库里就会有图书馆系统的数据。

3.安装JDBC数据源

  到控制面版点击JDBC数据源,新建数据库源,再进行配置,最后测试能否连上数据库。

附录B

原代码:主界面代码:

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

public class JLibrary extends JFrame implements ActionListener

{

 private JMenuBar menubar = new JMenuBar();

 private JMenu fileMenu,newbookMenu,searchMenu,getbooksMenu,buyMenu,addmembersMenu;

 private JMenuItem borrowbook,returnbook,print,exit,addbook,searchbook,updata,

         getbook,searchrecord,list1,list2,addmember;

 private borrowB borrow;

 private returnB returnb;

 private takeB takeb;

 private Addbs Addbss;

 private bbk bbks;

 private searchB searchb;

 private updataB updatab;

 private CancleList Canclelist;

 private SearchRecord Searchrecord;

 private membersID members;

 /*private borrowbooks borrowBook;

 private returnbooks returnBook;

 private addbooks addBook;

 private searchbooks searchBook;

 private getbooks getbook;

 private lists List1,List2;*/

 public JDesktopPane desktop = new JDesktopPane();

 public JLibrary()

 {

    super("LibrarySystem");

   

     setJMenuBar(menubar= new JMenuBar());

     menubar.add(fileMenu=new JMenu("文件"));

     menubar.add(newbookMenu=new JMenu("新书登记"));

     menubar.add(searchMenu=new JMenu("查询"));

     menubar.add(getbooksMenu=new JMenu("领书"));

     menubar.add(buyMenu=new JMenu("采购"));

     menubar.add(addmembersMenu=new JMenu("增加会员"));

     fileMenu.add(borrowbook=new JMenuItem("借书"));

     fileMenu.add(returnbook=new JMenuItem("还书"));

     fileMenu.add(print=new JMenuItem("打印"));

     fileMenu.add(exit=new JMenuItem("退出"));

    

       borrowbook.addActionListener(this);

       returnbook.addActionListener(this);

       print.addActionListener(this);

       exit.addActionListener(this);

      

     newbookMenu.add(addbook=new JMenuItem("新书编号"));

     newbookMenu.add(updata=new JMenuItem("更新书籍"));

       addbook.addActionListener(this);

       updata.addActionListener(this);

      

     searchMenu.add(searchbook=new JMenuItem("查找书籍"));

     searchMenu.add(searchrecord=new JMenuItem("查找记录"));

       searchbook.addActionListener(this);

       searchrecord.addActionListener(this);

      

     getbooksMenu.add(getbook=new JMenuItem("领取书籍"));

       getbook.addActionListener(this);

      

     buyMenu.add(list1=new JMenuItem("订购书籍"));

     buyMenu.add(list2=new JMenuItem("取消订购"));

       list1.addActionListener(this);

       list2.addActionListener(this);

      

     addmembersMenu.add(addmember=new JMenuItem("注册"));

       addmember.addActionListener(this);

      

     Container con=getContentPane();

    con.add(desktop);

     desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);

     addWindowListener(

                             new WindowAdapter() {

                                public void windowClosing(WindowEvent e) {

                                   System.exit(0);

                                }

                             });

     Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

         int width = 750, height = 550;

         if(screenSize.width >800)

            width = 950;

         if (screenSize.height >600)

            height = 650;

         setSize(width, height);

         setLocation((screenSize.width - width)/2,(screenSize.height-height) / 2);

         setVisible(true);

  }

  public void actionPerformed(ActionEvent ae) {

          if(ae.getSource() ==borrowbook) {

            Thread runner =

               new Thread() {

                  public void run() {

                     borrow=new borrowB();

                     desktop.add(borrow);

                     try {

                        borrow.setSelected(true);

                     }

                        catch(java.beans.PropertyVetoException e) {

                        }

                  }

               };

            runner.start();

         }

        if(ae.getSource() == returnbook) {

            Thread runner =

               new Thread() {

                  public void run() {

                     returnb=new returnB();

                     desktop.add(returnb);

                     try {

                        returnb.setSelected(true);

                     }

                        catch(java.beans.PropertyVetoException e) {

                        }

                  }

               };

            runner.start();

         }

           if(ae.getSource() == addbook) {

            Thread runner =

               new Thread() {

                  public void run() {

                     Addbss=new Addbs();

                     desktop.add(Addbss);

                     try {

                        Addbss.setSelected(true);

                     }

                        catch(java.beans.PropertyVetoException e) {

                        }

                  }

               };

            runner.start();

         }

          if(ae.getSource() ==updata) {

            Thread runner =

               new Thread() {

                  public void run() {

                     updatab=new updataB();

                     desktop.add(updatab);

                     try {

                        updatab.setSelected(true);

                     }

                        catch(java.beans.PropertyVetoException e) {

                        }

                  }

               };

            runner.start();

         }

        if(ae.getSource() ==searchbook) {

            Thread runner =

               new Thread() {

                  public void run() {

                     searchb =new searchB();

                     desktop.add(searchb);

                     try {

                        searchb.setSelected(true);

                     }

                        catch(java.beans.PropertyVetoException e) {

                        }

                  }

               };

            runner.start();

         }

         if(ae.getSource()==getbook) {

            Thread runner =

               new Thread() {

                  public void run() {

                     takeb=new takeB();

                     desktop.add(takeb);

                     try {

                        takeb.setSelected(true);

                     }

                        catch(java.beans.PropertyVetoException e) {

                        }

                  }

               };

            runner.start();

         }

        if(ae.getSource() ==list1) {

            Thread runner =

               new Thread() {

                  public void run() {

                     bbks =new bbk();

                     desktop.add(bbks);

                     try {

                        bbks.setSelected(true);

                     }

                        catch(java.beans.PropertyVetoException e) {

                        }

                  }

               };

            runner.start();

         }

    

        

          /*  if(ae.getSource() == exit) {

            dispose();

            System.exit(0);

         }*/

         if(ae.getSource() ==list2) {

            Thread runner =

               new Thread() {

                  public void run() {

                     Canclelist=new CancleList();

                     desktop.add(Canclelist);

                     try {

                        Canclelist.setSelected(true);

                     }

                        catch(java.beans.PropertyVetoException e) {

                        }

                  }

               };

            runner.start();

         }

         if(ae.getSource() ==searchrecord) {

            Thread runner =

               new Thread() {

                  public void run() {

                     Searchrecord=new SearchRecord();

                     desktop.add(Searchrecord);

                     try {

                        Searchrecord.setSelected(true);

                     }

                        catch(java.beans.PropertyVetoException e) {

                        }

                  }

               };

            runner.start();

         }

         if(ae.getSource() ==addmember) {

            Thread runner =

               new Thread() {

                  public void run() {

                     members=new membersID();

                     desktop.add(members);

                     try {

                        members.setSelected(true);

                     }

                        catch(java.beans.PropertyVetoException e) {

                        }

                  }

               };

            runner.start();

         }

      }

      public static void main(String arg[])

      {JLibrary win=new JLibrary();

        /*new Thread().start();*/

      }

 }

订购代码:

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

public class bbk extends JInternalFrame implements ActionListener

{ JTextField text1,text2,text3,text4,text5,text6;JButton button1,button2;

  bbk()

  {super("booklist",true,true,true,true);

  Container con=getContentPane();

  setVisible(true);

  try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}

     catch(ClassNotFoundException e){}

     try{Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

     Statement Stmt=Con.createStatement();}

     catch(SQLException ee){}

  text1=new JTextField(10);text2=new JTextField(10);

  text3=new JTextField(10);text4=new JTextField(10);

  text5=new JTextField(10);text6=new JTextField(10);

  button1=new JButton("提交");button2=new JButton("取消");

  button1.addActionListener(this);button2.addActionListener(this);

  JPanel p1=new JPanel();JPanel p2=new JPanel();

  p1.setLayout(new GridLayout(6,2));

  p1.add(new Label("会员号"));p1.add(text1);

  p1.add(new Label("书名"));p1.add(text2);

  p1.add(new Label("出版社"));p1.add(text3);

  p1.add(new Label("作者"));p1.add(text4);

  p1.add(new Label("数量"));p1.add(text5);

  p1.add(new Label("订书时间"));p1.add(text6);text6.setText(new java.util.Date().toString());

  text6.setEditable(false);

  p2.add(button1);p2.add(button2);

  con.add(p1,BorderLayout.NORTH);con.add(p2,BorderLayout.SOUTH);

  pack();

 }

   public void actionPerformed(ActionEvent e)

   { if(e.getSource()==button1)

       {try{bbk1();}

       catch(SQLException ee){}

       }

   if(e.getSource()==button2)

        {setVisible(false);}

   }

   public void bbk1() throws SQLException

   { String s1="'"+text1.getText().trim()+"'",

            s2="'"+text2.getText().trim()+"'",

            s3="'"+text3.getText().trim()+"'",

            s4="'"+text4.getText().trim()+"'",

            s5="'"+text5.getText().trim()+"'",

            s6="'"+text6.getText().trim()+"'";

  

    Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

    Statement Stmt=Con.createStatement();

    String temp="INSERT INTO List(MembersID,BookName,Edition,Author,Quantity,Bookdate) VALUES("+s1+","+s2+","+s3+","+s4+","+s5+","+s6+")";

             

    Stmt.executeUpdate(temp);

    JOptionPane.showMessageDialog(null,"成功订货","success",JOptionPane.INFORMATION_MESSAGE);

    text1.setText(null);text2.setText(null);text3.setText(null);

    text4.setText(null);text5.setText(null);

    Con.close();

    }

   public static void main(String args[])

     {bbk win=new bbk();}

  }

取消订购代码:

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

public class CancleList extends JInternalFrame implements ActionListener

{ JTextField text,text1,text2,text3,text4;JButton button1,button2,button3;

  int www=0;

  public CancleList()

  { super("cancla",true,true,true,true);

    setVisible(true);

       try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}

       catch(ClassNotFoundException e){}

       try{Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

       Statement sql=Con.createStatement();}

       catch(SQLException ee){}

    Container con=getContentPane();

    text=new JTextField(10);

    button1=new JButton("查找");

    JPanel p1=new JPanel();

    p1.add(new Label("订单号"));p1.add(text);p1.add(button1);

    button1.addActionListener(this);

         text1=new JTextField(10);text2=new JTextField(10);

         text3=new JTextField(10);text4=new JTextField(10);

         button2=new JButton("更改订单");button3=new JButton("取消订单");

         JPanel p2=new JPanel(),p3=new JPanel();

         p2.setLayout(new GridLayout(4,2));

         p2.add(new Label("书名"));p2.add(text1);

         p2.add(new Label("作者"));p2.add(text2);

         p2.add(new Label("出版社"));p2.add(text3);

         p2.add(new Label("订购数量"));p2.add(text4);

         p3.add(button2);p3.add(button3);

         button2.addActionListener(this);button3.addActionListener(this);

    con.add(p1,BorderLayout.NORTH);con.add(p2,BorderLayout.CENTER);

    con.add(p3,BorderLayout.SOUTH);

    pack();

  }

    public void actionPerformed(ActionEvent e)

    { if(e.getSource()==button1)

        {www=0;

          try{search1();}

          catch(SQLException ee){}

         }

     

      if(e.getSource()==button2)

        {try{update1();}

         catch(SQLException ee){}

        }

       

      if(e.getSource()==button3)

        {try{cancle();}

        catch(SQLException ee){}

        }

     }

     public void search1() throws SQLException

     { String listnumber,bookname,author,edition,quantity;

              Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

              Statement sql=Con.createStatement();

              ResultSet rs=sql.executeQuery("SELECT * FROM List");

              while(rs.next())

              {listnumber=rs.getString("ListNumber");

               bookname=rs.getString("BookName");

               author=rs.getString("Author");

               edition=rs.getString("Edition");

               quantity=rs.getString("Quantity");

                    if(listnumber.trim().equals(text.getText().trim()))

                      {text1.setText(bookname);text2.setText(author);text3.setText(edition);

                       text4.setText(quantity);www=1;break;

                      }

               }

               if(www==0)

               {text.setText("没有此订单");}

      }

      public void update1() throws SQLException

      { String s1="'"+text1.getText().trim()+"'",

               s2="'"+text2.getText().trim()+"'",        

               s3="'"+text3.getText().trim()+"'",

               s4="'"+text4.getText().trim()+"'",

               s="'"+text.getText().trim()+"'";

        String temp="UPDATE List SET BookName="+s1+",Author="+s2+",Edition="+s3+",Quantity="+s4+" WHERE ListNumber="+s+"";

                 Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

                 Statement sql=Con.createStatement();

                 sql.executeUpdate(temp);

                 JOptionPane.showMessageDialog(null,"更改成功","success",JOptionPane.INFORMATION_MESSAGE);

                 text.setText(null);text1.setText(null);text2.setText(null);

                 text3.setText(null);text4.setText(null);

                 Con.close();

       }         

       public void cancle()throws SQLException

       { String s="'"+text.getText().trim()+"'";

         String temp="DELETE FROM List WHERE ListNumber="+s+"";

                 Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

                 Statement sql=Con.createStatement();

                 sql.executeUpdate(temp);

                 JOptionPane.showMessageDialog(null,"取消订货","success",JOptionPane.INFORMATION_MESSAGE);  

                 text.setText(null);text1.setText(null);text2.setText(null);

                 text3.setText(null);text4.setText(null);

                 Con.close();

       }

        

        

                    

        public static void main(String args[])

     {CancleList win=new CancleList();}

}

     

    

借书:

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

public class borrowB extends JInternalFrame implements ActionListener

{ JTextField text,text1,text2,text3,text4,text5;JButton button1,button2,button3;JSplitPane split;

  private searchB searchb;

  private membersID memberID;

  int www=0;

  borrowB()

  {super("borrow",true,true,true,true);

   Container con=getContentPane();

   setVisible(true);setSize(100,100);

     try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}

     catch(ClassNotFoundException e){}

     try{Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

     Statement Stmt=Con.createStatement();}

     catch(SQLException ee){}

     text=new JTextField(10);

   text1=new JTextField(10);text2=new JTextField(10);

   text3=new JTextField(10);text4=new JTextField(10);

   text5=new JTextField(10);

   text1.setEditable(false);text2.setEditable(false);

   text3.setEditable(false);text4.setEditable(false);

   text5.setEditable(false);

  

   button1=new JButton("借书");button2=new JButton("取消");

   button3=new JButton("登陆");

   JPanel p1=new JPanel();JPanel p2=new JPanel();JPanel p3=new JPanel();

   p1.add(new Label("输入会员号"));p1.add(text);

   p1.add(button3);

   p2.setLayout(new GridLayout(6,2));

  

    p2.add(new Label("书的作者"));p2.add(text1);

    p2.add(new Label("书的号码"));p2.add(text2);

    p2.add(new Label("书的名字"));p2.add(text3);

    p2.add(new Label("书的出版社"));p2.add(text4);

    p2.add(new Label("借书日期"));p2.add(text5);text5.setText(new java.util.Date().toString());

    p2.add(new Label("登陆后请填写以上信息"));

    p3.add(button1);p3.add(button2);

   button1.addActionListener(this);

   button2.addActionListener(this);

   button3.addActionListener(this);

   con.add(p1,BorderLayout.NORTH);con.add(p2,BorderLayout.CENTER);

   con.add(p3,BorderLayout.SOUTH);

   pack();

  

    }

   public void actionPerformed(ActionEvent e)

   {if(e.getSource()==button3)

      {www=0;

        try{search1();}

      catch(SQLException ee){}

      }

     

     if(e.getSource()==button1)

     {try{borrow1();}

      catch(SQLException ee){}

     }

    

     if(e.getSource()==button2)

      {setVisible(false);}

    }

 public void search1() throws SQLException

 {String IDnumber;

         Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

         Statement Stmt=Con.createStatement();

         ResultSet rs=Stmt.executeQuery("SELECT * FROM Member");

         while(rs.next())

          {IDnumber=rs.getString("MembersID");

           if(IDnumber.equals(text.getText().trim()))

            {text1.setEditable(true);text2.setEditable(true);

            text3.setEditable(true);text4.setEditable(true);

           www=1;break;

             }

           }

           Con.close();

          

            if(www==0)

                   {text.setText("没有此ID");

                   text1.setEditable(false);text2.setEditable(false);

                   text3.setEditable(false);text4.setEditable(false);}

          

 }

 public void borrow1() throws SQLException

 {String s1="'"+text1.getText().trim()+"'",

         s2="'"+text2.getText().trim()+"'",

         s3="'"+text3.getText().trim()+"'",

         s4="'"+text4.getText().trim()+"'",

         s5="'"+text5.getText().trim()+"'",

         s6="'"+text.getText().trim()+"'";

  

   Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

   Statement Stmt=Con.createStatement();

   String temp="INSERT INTO BorrowRecord(Author,BooksID,BookName,Edition,Borrowdate,MembersID) VALUES ("+s1+","+s2+","+s3+","+s4+","+s5+","+s6+")";

             

  Stmt.executeUpdate(temp);

  JOptionPane.showMessageDialog(null,"成功借出","success",JOptionPane.INFORMATION_MESSAGE);

  text1.setText(null);text2.setText(null);text3.setText(null);

  text4.setText(null);

  Con.close();

  }

 public static void main(String args[])

   {borrowB win=new borrowB();

   }

 }

还书:

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

public class returnB extends JInternalFrame implements ActionListener

{JTextField text1,text2,text3,text4,text5;JButton button1,button2,button3;

  public returnB()

  {super("return",true,true,true,true);

   setVisible(true);setBounds(300,200,200,150);

          try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}

             catch(ClassNotFoundException e){}

          try{Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

             Statement sql=Con.createStatement();}

             catch(SQLException ee){}

   Container con=getContentPane();

   text1=new JTextField(10);text2=new JTextField(10);

   text3=new JTextField(10);text4=new JTextField(10);

   text5=new JTextField(10);

   button1=new JButton("查询");button2=new JButton("还书");button3=new JButton("取消");

   JPanel p1=new JPanel();JPanel p2=new JPanel(),p3=new JPanel();

      p1.add(new Label("书号"));p1.add(text1);p1.add(button1);

      p2.setLayout(new GridLayout(4,2));

      p2.add(new Label("会员号"));p2.add(text2);

      p2.add(new Label("书名"));p2.add(text3);

      p2.add(new Label("借书日期"));p2.add(text4);

      p2.add(new Label("借书记录号"));p2.add(text5);

      p3.add(button2);p3.add(button3);

   button1.addActionListener(this);

   button2.addActionListener(this);

   button3.addActionListener(this);

   con.add(p1,BorderLayout.NORTH);

   con.add(p2,BorderLayout.CENTER);

   con.add(p3,BorderLayout.SOUTH);

   pack();

  }

 public void actionPerformed(ActionEvent e)

  {if(e.getSource()==button1)

      {try{return1();}

       catch(SQLException ee){}

      }

   if(e.getSource()==button2)

      {try{del();}

      catch(SQLException ee){}

      }

    if(e.getSource()==button3)

   { setVisible(false);}

  }

  public void return1() throws SQLException

  {String bookID,memberID,bookname,borrowdate,recordnumber;

          Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

          Statement sql=Con.createStatement();

          ResultSet rs=sql.executeQuery("SELECT * FROM BorrowRecord");

         

          while(rs.next())

          { recordnumber=rs.getString("RecordNumber");

            bookID=rs.getString("BooksID");

            memberID=rs.getString("MembersID");

            borrowdate=rs.getString("Borrowdate");

            bookname=rs.getString("BookName");

           

               if(bookID.trim().equals(text1.getText().trim()))

               {text2.setText(memberID);

                text4.setText(borrowdate);

                text3.setText(bookname);

                text5.setText(recordnumber);

               

               }

            }

            Con.close();

           

           

    }

     public void del() throws SQLException

     {  String s="'"+text5.getText().trim()+"'";

        String temp="DELETE FROM BorrowRecord WHERE RecordNumber="+s+"";

       

        Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

        Statement sql=Con.createStatement();

       

        sql.executeUpdate(temp);

        JOptionPane.showMessageDialog(null,"成功还书","success",JOptionPane.INFORMATION_MESSAGE);

        Con.close();

     }

       

      

         

         

public static void main(String args[])

   {returnB win=new returnB();}

 }

  

  

  

领取书籍:

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

public class takeB extends JInternalFrame implements ActionListener

{JTextField text1,text2,text3,text4,text5,text6;

 JButton button1,button2,button3;int www=0;

 public takeB()

   {super("getbook",true,true,true,true);

    Container con=getContentPane();

    setVisible(true);

    try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}

       catch(ClassNotFoundException e){}

       try{Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

       Statement sql=Con.createStatement();}

       catch(SQLException ee){}

    text1=new JTextField(10);text2=new JTextField(10);

    text3=new JTextField(10);text4=new JTextField(10);

    text5=new JTextField(10);text6=new JTextField(10);

    button1=new JButton("领书");button2=new JButton("取消");

    button3=new JButton("查找订单");

    button1.addActionListener(this);

    button2.addActionListener(this);

    button3.addActionListener(this);

    JPanel p1=new JPanel();JPanel p2=new JPanel(),p3=new JPanel();

    p3.add(new Label("输入订单号"));p3.add(text6);p3.add(button3);

    p1.setLayout(new GridLayout(5,2));

    p1.add(new Label("订货会员号"));p1.add(text1);

    p1.add(new Label("书的名字"));p1.add(text2);

    p1.add(new Label("出版社"));p1.add(text3);

    p1.add(new Label("作者"));p1.add(text4);

    p1.add(new Label("数量"));p1.add(text5);

    p2.add(button1);p2.add(button2);

    con.add(p3,BorderLayout.NORTH);con.add(p1,BorderLayout.CENTER);

    con.add(p2,BorderLayout.SOUTH);

    pack();

  

   }

    public void actionPerformed(ActionEvent e)

    {if(e.getSource()==button3)

      {www=0;

        try{takeb1();}

       catch(SQLException ee){}

      }

     

      

     

        if(e.getSource()==button2)

        {setVisible(false);}

     }

   public void takeb1() throws SQLException

   {String listnumber,memberID,bookname,edition,author,quantity;

           Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

           Statement sql=Con.createStatement();

           ResultSet rs=sql.executeQuery("SELECT * FROM List");

          

           while(rs.next())

           {  listnumber=rs.getString("ListNumber");

              bookname=rs.getString("BookName");

              author=rs.getString("Author");

              edition=rs.getString("Edition");

              quantity=rs.getString("Quantity");

              memberID=rs.getString("MembersID");

            if(listnumber.trim().equals(text6.getText().trim()))

              {text1.setText(memberID);text2.setText(bookname);

               text3.setText(edition);text4.setText(author);

               text5.setText(quantity);www=1;break;

               }

          

             }

        Con.close();

            if(www==0)

             {text6.setText("没有此订单");

              text1.setText(null);text2.setText(null);

              text3.setText(null);text4.setText(null);

              text5.setText(null);

             }

    }

              

          

          

    public static void main(String args[])

    {takeB win=new takeB();}

   }

查询书籍:

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

public class searchB extends JInternalFrame implements ActionListener

{ JTextField text1;JTextArea text;

  JButton button1,button2;

  int www=0;

 public searchB()

  { super("search",true,true,true,true);

    Container con=getContentPane();

    setVisible(true);setSize(150,300);

    text1=new JTextField(10);

   

    text=new JTextArea(10,10);text.setBackground(Color.pink);text.setEditable(false);

    button1=new JButton("查找");button2=new JButton("取消");

    JPanel p1=new JPanel();JPanel p2=new JPanel();JPanel p3=new JPanel();

    p1.setLayout(new GridLayout(1,1));

    p1.add(new Label("书的名字"));p1.add(text1);

    p2.add(button1);p2.add(button2);

    p3.add(text);

    button1.addActionListener(this);

    button2.addActionListener(this);

    con.add(p1,BorderLayout.NORTH);con.add(p2,BorderLayout.SOUTH);

    con.add(p3,BorderLayout.CENTER);

    pack();

   }

 public void actionPerformed(ActionEvent e)

 {if(e.getSource()==button1)

  {www=0;

    text.setText("查询结果"+"\n");

    try{search1();}

    catch(SQLException ee){}

  }

   

   

    if(e.getSource()==button2)

    {setVisible(false);}

  }

  public void search1() throws SQLException

  {String name,author,edition,booksID;

    try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}

    catch(ClassNotFoundException e){}

    Connection con=DriverManager.getConnection("jdbc:odbc:Library");

    Statement sql=con.createStatement();

    ResultSet rs=sql.executeQuery("SELECT * FROM Library");

    while(rs.next())

    {  booksID=rs.getString(3);name=rs.getString(4);

       author=rs.getString(5);

       edition=rs.getString(6);

       if(name.trim().equals(text1.getText().trim()))

        {text.append("书号:"+booksID+"\n"+"书名:"+name+"\n"+"作者"+author+"\n"+"出版社"+edition+"\n");

          www=1;break;}

      }

        con.close();

        if(www==0)

          {text.setText("没有此书");}

   }

  public static void main(String args[])

  {searchB win=new searchB();}

 }

查询记录:

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

public class SearchRecord extends JInternalFrame implements ActionListener

{ JTextField text,text1,text2,text3;JButton button1,button2;

  public SearchRecord()

  { super("searchrecord",true,true,true,true);

    setVisible(true);

        try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}

        catch(ClassNotFoundException e){}

        try{Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

        Statement Stmt=Con.createStatement();}

        catch(SQLException ee){}

    Container con=getContentPane();

    text=new JTextField(10);

    button1=new JButton("查找");

    JPanel p1=new JPanel();

    p1.add(new Label("书名"));p1.add(text);p1.add(button1);

    button1.addActionListener(this);

         text1=new JTextField(10);text2=new JTextField(10);

         text3=new JTextField(10);

         button2=new JButton("关闭");

         JPanel p2=new JPanel(),p3=new JPanel();

         p2.setLayout(new GridLayout(3,2));

         p2.add(new Label("借书人会员号"));p2.add(text1);

         p2.add(new Label("借书日期"));p2.add(text2);

         p2.add(new Label("书号"));p2.add(text3);

         p3.add(button2);

         button2.addActionListener(this);

    con.add(p1,BorderLayout.NORTH);con.add(p2,BorderLayout.CENTER);

    con.add(p3,BorderLayout.SOUTH);

    pack();

  }

    public void actionPerformed(ActionEvent e)

    { if(e.getSource()==button1)

        {try{searchR();}

         catch(SQLException ee){}

       

        }

     

      if(e.getSource()==button2)

        {setVisible(false);}

     

     }

    public void searchR() throws SQLException

     {String bookid,memberid,borrowtime,name;

         Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

         Statement Stmt=Con.createStatement();

         ResultSet rs=Stmt.executeQuery("SELECT * FROM BorrowRecord");

            

         while(rs.next())

           {bookid=rs.getString("BooksID");memberid=rs.getString("MembersID");borrowtime=rs.getString("Borrowdate");

             name=rs.getString("BookName");

          

            if(name.trim().equals(text.getText().trim()))

              {

                text1.setText(memberid);text2.setText(borrowtime);text3.setText(bookid);

             }

           }

     

      }

     public static void main(String args[])

       {SearchRecord win=new SearchRecord();}

}          

新书编目:

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

class Addbs extends JInternalFrame implements ActionListener

{JTextField text1,text2,text3,text4,text5,text6;JButton button1,button2;

 Addbs()

 {super("addbook",true,true,true,true);

  Container con=getContentPane();

  setVisible(true);setBounds(300,200,200,250);

     try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}

     catch(ClassNotFoundException e){}

     try{Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

     Statement Stmt=Con.createStatement();}

     catch(SQLException ee){}

  text1=new JTextField(10);text2=new JTextField(10);

  text3=new JTextField(10);text4=new JTextField(10);

  text5=new JTextField(10);text6=new JTextField(10);

  button1=new JButton("添书");button2=new JButton("取消");

  button1.addActionListener(this);button2.addActionListener(this);

  JPanel p1=new JPanel();JPanel p2=new JPanel();

  p1.setLayout(new GridLayout(3,2));

  p1.add(new Label("科目"));p1.add(text1);

  p1.add(new Label("数量"));p1.add(text2);

  p1.add(new Label("书名"));p1.add(text3);

  p1.add(new Label("作者"));p1.add(text4);

  p1.add(new Label("出版社"));p1.add(text5);

  p1.add(new Label("入库时间"));p1.add(text6);

  p2.add(button1);p2.add(button2);

  con.add(p1,BorderLayout.NORTH);

  con.add(p2,BorderLayout.SOUTH);pack();

  }

    public void actionPerformed(ActionEvent e)

    {if(e.getSource()==button1)

       {try{Addbs1();}

        catch(SQLException ee){}

       }

        if(e.getSource()==button2)

        {setVisible(false);}

    }

    public void Addbs1() throws SQLException

    {String s1="'"+text1.getText().trim()+"'",

            s2="'"+text2.getText().trim()+"'",

            s3="'"+text3.getText().trim()+"'",

            s4="'"+text4.getText().trim()+"'",

            s5="'"+text5.getText().trim()+"'",

            s6="'"+text6.getText().trim()+"'";

          Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

          Statement Stmt=Con.createStatement();

          String temp="INSERT INTO Library(Category,Quantity,BookName,Author,Edition,Storetime) VALUES ("+s1+","+s2+","+s3+","+s4+","+s5+","+s6+")";             

          Stmt.executeUpdate(temp);

          JOptionPane.showMessageDialog(null,"The book is ok","success",JOptionPane.INFORMATION_MESSAGE);

          text1.setText(null);text2.setText(null);text3.setText(null);

          text4.setText(null);text5.setText(null);text6.setText(null);

          Con.close();

         

     }

 public static void main(String args[])

  {Addbs win=new Addbs();}

}

更新书籍:

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

public class updataB extends JInternalFrame implements ActionListener

{ JTextField text,text1,text2,text3,text4,text5;JButton button1,button2,button3;

  int www=0;

  public updataB()

  { super("update",true,true,true,true);

    setVisible(true);

       try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}

       catch(ClassNotFoundException e){}

       try{Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

       Statement sql=Con.createStatement();}

       catch(SQLException ee){}

    Container con=getContentPane();

    text=new JTextField(10);

    button1=new JButton("查找");

    JPanel p1=new JPanel();

    p1.add(new Label("书号"));p1.add(text);p1.add(button1);

    button1.addActionListener(this);

         text1=new JTextField(10);text2=new JTextField(10);

         text3=new JTextField(10);text4=new JTextField(10);

         text5=new JTextField(10);

         button2=new JButton("更改");button3=new JButton("取消");

         JPanel p2=new JPanel(),p3=new JPanel();

         p2.setLayout(new GridLayout(5,2));

         p2.add(new Label("科目"));p2.add(text1);

         p2.add(new Label("数量"));p2.add(text2);

         p2.add(new Label("书名"));p2.add(text3);

         p2.add(new Label("作者"));p2.add(text4);

         p2.add(new Label("出版社"));p2.add(text5);

         p3.add(button2);p3.add(button3);

         button2.addActionListener(this);button3.addActionListener(this);

    con.add(p1,BorderLayout.NORTH);con.add(p2,BorderLayout.CENTER);

    con.add(p3,BorderLayout.SOUTH);

    pack();

  }

    public void actionPerformed(ActionEvent e)

    { if(e.getSource()==button1)

        {www=0;

          try{search2();}

           catch(SQLException ee){}

        }

     

      if(e.getSource()==button2)

        {try{updataB1();}

          catch(SQLException ee){}

            }

      if(e.getSource()==button3)

        {setVisible(false);}

     }

    public void search2() throws SQLException

    {  String booksID,category,quantity,name,author,edition;

        Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

        Statement sql=Con.createStatement();

         ResultSet rs=sql.executeQuery("SELECT * FROM Library");

         while(rs.next())

         {   category=rs.getString(1);

             quantity=rs.getString(2);

             booksID=rs.getString(3);

             name=rs.getString(4);

             author=rs.getString(5);

             edition=rs.getString(6);

            if(booksID.trim().equals(text.getText().trim()))

            {text1.setText(category);text2.setText(quantity);

             text3.setText(name);text4.setText(author);

             text5.setText(edition);www=1;break;

             }

           }

           Con.close();

               if(www==0)

               {text.setText("没有此书");

               text1.setText(null);text2.setText(null);

               text3.setText(null);text4.setText(null);

               text5.setText(null);}

         

     }

     public void updataB1() throws SQLException

     {String s1="'"+text1.getText().trim()+"'",

             s2="'"+text2.getText().trim()+"'",

             s3="'"+text3.getText().trim()+"'",

             s4="'"+text4.getText().trim()+"'",

             s5="'"+text5.getText().trim()+"'",

             s="'"+text.getText().trim()+"'";

      String temp="UPDATE Library SET Category="+s1+",Quantity="+s2+",BookName="+s3+",Author="+s4+",Edition="+s5+" WHERE BooksID="+s+"";

                  

             Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

             Statement sql=Con.createStatement();

             sql.executeUpdate(temp);

             Con.close();

      }

    

        public static void main(String args[])

     {updataB wind=new updataB();}

}

     

    

增加会员:

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

public class membersID extends JInternalFrame implements ActionListener

{ JTextField text1,text2,text3,text4;;JButton button1,button2;

   membersID()

  {super("welcome",true,true,true,true);

   Container con=getContentPane();

   setVisible(true);

     try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}

     catch(ClassNotFoundException e){}

     try{Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

     Statement Stmt=Con.createStatement();}

     catch(SQLException ee){}

   text1=new JTextField(10);text2=new JTextField(10);

   text3=new JTextField(10);text4=new JTextField(10);

   button1=new JButton("注册");button2=new JButton("取消");

   JPanel p1=new JPanel();JPanel p2=new JPanel();

   p1.setLayout(new GridLayout(4,2));

   p1.add(new Label("新的会员号(只能数字):"));p1.add(text1);

   p1.add(new Label("你的名字:"));p1.add(text2);

   p1.add(new Label("班级:"));p1.add(text3);

   p1.add(new Label("学号(只能数字):"));p1.add(text4);

   p2.add(button1);p2.add(button2);

   con.add(p1,BorderLayout.NORTH);

   con.add(p2,BorderLayout.SOUTH); 

   button1.addActionListener(this);button2.addActionListener(this);

   pack();

  

  }

  public void actionPerformed(ActionEvent e)

  {if(e.getSource()==button1)

     {try{newmembers();}

      catch(SQLException ee){}

     }

    

     if(e.getSource()==button2)

     {setVisible(false);}

   }

   public void newmembers() throws SQLException

   {String s1="'"+text1.getText().trim()+"'",

           s2="'"+text2.getText().trim()+"'",

           s3="'"+text3.getText().trim()+"'",

           s4="'"+text4.getText().trim()+"'";

           Connection Con=DriverManager.getConnection("jdbc:odbc:Library","","");

           Statement Stmt=Con.createStatement();

           String temp="INSERT INTO Member(MembersID,StudentName,Class,StudentNumber) VALUES("+s1+","+s2+","+s3+","+s4+")";

           Stmt.executeUpdate(temp);

           JOptionPane.showMessageDialog(null,"注册成功","success",JOptionPane.INFORMATION_MESSAGE);

           text1.setText(null);text2.setText(null);

           text3.setText(null);text4.setText(null);

   }

   public static void main(String args[])

   {membersID win=new membersID();}

 }

参考资料:

java毕业设计——JAVA图书馆书库管理系统论文.zip

Java毕业设计174例,包含部署视频-CSDN博客

Guess you like

Origin blog.csdn.net/2301_78287784/article/details/130877073