📄 5.还书界面.txt
字号:
try
{
String str5_2_3;
str5_2_3=jTextField3.getText();
Statement stmt5_2_2 = conn.createStatement(ResultSet.
TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sq5_2_2 = "select * from book where 编号 = '"+str5_2_3+"'";
ResultSet rs5_2_2 = stmt5_2_2.executeQuery(sq5_2_2);
if(!rs5_2_2.next())
{
JOptionPane.showMessageDialog(this,"编号错误","错误",JOptionPane.ERROR_MESSAGE);
}
else{
Statement stmt5_2_3 = conn.createStatement(ResultSet.
TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sq5_2_3 = "select 借阅情况,借书ID from book where 借书ID ='"+str5_2_1+"' ";
ResultSet rs5_2_3 = stmt5_2_3.executeQuery(sq5_2_3);
String a=new String("送书");
if((rs5_2_3.next()&&rs5_2_3.getString("借阅情况").equals(a)))
{
JOptionPane.showMessageDialog(this,"此书没有被你所借","错误",JOptionPane.ERROR_MESSAGE);
stmt5_2_3.close();
}
else
{
Statement stmt4_1_52 = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sq4_1_52 = "select * from book where 编号 = '"+str5_2_3+"'";
ResultSet rs4_1_52 = stmt4_1_52.executeQuery(sq4_1_52);
if(rs4_1_52.next())
{ String rs1item1 = rs4_1_52.getString("编号");
String rs1item2 = rs4_1_52.getString("书名");
String rs1item3 = rs4_1_52.getString( "作者");
String rs1item4 = rs4_1_52.getString("出版社");
jTextArea1.setText("编号: " +
rs1item1 +
'\n' +
"书名: " + rs1item2 + '\n' +
"作者: " + rs1item3 + '\n' +
"出版社: " + rs1item4 +
'\n');}
JOptionPane.showMessageDialog(this, "请核对所要归还的书籍信息", "成功还书",JOptionPane.OK_CANCEL_OPTION);
try {
Statement stmt5_2_4 = conn.createStatement(
ResultSet.
TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sq5_2_4 ="update reader set 已借书籍2 = '未借' where ID ='"+str5_2_1+"'";
stmt5_2_4.executeUpdate(sq5_2_4);
Statement stmt5_2_5 = conn.createStatement(ResultSet.
TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sq5_2_5 = "update book set 借阅情况 = '收书' where 编号 ='"+str5_2_3+"'";
stmt5_2_5.executeUpdate(sq5_2_5);
Statement stmt5_2_6 = conn.createStatement(ResultSet.
TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sq5_2_6 = "update book set 借书ID = '' where 编号 ='"+str5_2_3+"'";
stmt5_2_6.executeUpdate(sq5_2_6);
} catch (Exception e) {
System.err.println(e);
}
}
}
}
catch(Exception e)
{
System.err.println(e);
}
}
}
catch(Exception e)
{
System.err.println(e);
}
}// F5_2()
public void jButton3_actionPerformed(ActionEvent e) {
F5_3();
}
void F5_3(){
try
{
String str5_3_1,str5_3_2;
str5_3_1=jTextField1.getText();
str5_3_2=new String(jPasswordField1.getPassword());
Statement stmt5_3_1 = conn.createStatement(ResultSet.
TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sq5_3_l= "select * from reader where ID='"+str5_3_1+"' AND 密码 = '"+str5_3_2+"' ";
ResultSet rs5_3_1 = stmt5_3_1.executeQuery(sq5_3_l);
if(!rs5_3_1.next())
{
JOptionPane.showMessageDialog(this,"帐号或者密码错误","错误",JOptionPane.ERROR_MESSAGE);
}
else
{
stmt5_3_1.close();
try
{
String str5_3_3;
str5_3_3=jTextField4.getText();
Statement stmt5_3_2 = conn.createStatement(ResultSet.
TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sq5_3_2 = "select * from book where 编号 = '"+str5_3_3+"'";
ResultSet rs5_3_2 = stmt5_3_2.executeQuery(sq5_3_2);
if(!rs5_3_2.next())
{
JOptionPane.showMessageDialog(this,"编号错误","错误",JOptionPane.ERROR_MESSAGE);
}
else{
Statement stmt5_3_3 = conn.createStatement(ResultSet.
TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sq5_3_3 = "select 借阅情况,借书ID from book where 借书ID ='"+str5_3_1+"' ";
ResultSet rs5_3_3 = stmt5_3_3.executeQuery(sq5_3_3);
String a=new String("送书");
if((rs5_3_3.next()&&!rs5_3_3.getString("借阅情况").equals(a)))
{
JOptionPane.showMessageDialog(this,"此书没有被你所借","错误",JOptionPane.ERROR_MESSAGE);
stmt5_3_3.close();
}
else
{
Statement stmt4_1_53 = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sq4_1_53 = "select * from book where 编号 = '"+str5_3_3+"'";
ResultSet rs4_1_53 = stmt4_1_53.executeQuery(sq4_1_53);
if(rs4_1_53.next())
{ String rs1item1 = rs4_1_53.getString("编号");
String rs1item2 = rs4_1_53.getString("书名");
String rs1item3 = rs4_1_53.getString( "作者");
String rs1item4 = rs4_1_53.getString("出版社");
jTextArea1.setText("编号: " +
rs1item1 +
'\n' +
"书名: " + rs1item2 + '\n' +
"作者: " + rs1item3 + '\n' +
"出版社: " + rs1item4 +
'\n');}
JOptionPane.showMessageDialog(this, "请核对所要归还的书籍信息", "成功还书",
JOptionPane.OK_CANCEL_OPTION);
try {
Statement stmt5_3_4 = conn.createStatement(
ResultSet.
TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sq5_3_4 ="update reader set 已借书籍3 = '未借' where ID ='"+str5_3_1+"'";
stmt5_3_4.executeUpdate(sq5_3_4);
Statement stmt5_3_5 = conn.createStatement(ResultSet.
TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sq5_3_5 = "update book set 借阅情况 = '未借' where 编号 ='"+str5_3_3+"'";
stmt5_3_5.executeUpdate(sq5_3_5);
Statement stmt5_3_6 = conn.createStatement(ResultSet.
TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sq5_3_6 = "update book set 借书ID ='' where 编号 ='"+str5_3_3+"'";
stmt5_3_6.executeUpdate(sq5_3_6);
} catch (Exception e) {
System.err.println(e);
}
}
}
}
catch(Exception e)
{
System.err.println(e);
}
}
}
catch(Exception e)
{
System.err.println(e);
}
} // F5_3()
public void jButton4_actionPerformed(ActionEvent e) {
F5_4();
}
void F5_4(){
try
{
String str5_4_1,str5_4_2;
str5_4_1=jTextField1.getText();
str5_4_2=new String(jPasswordField1.getPassword());
Statement stmt5_4_1 = conn.createStatement(ResultSet.
TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sq5_4_l= "select * from reader where ID='"+str5_4_1+"' AND 密码 = '"+str5_4_2+"' ";
ResultSet rs5_4_1 = stmt5_4_1.executeQuery(sq5_4_l);
if(!rs5_4_1.next())
{
JOptionPane.showMessageDialog(this,"帐号或者密码错误","错误",JOptionPane.ERROR_MESSAGE);
}
else
{
stmt5_4_1.close();
try
{
String str5_4_3;
str5_4_3=jTextField5.getText();
Statement stmt5_4_2 = conn.createStatement(ResultSet.
TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sq5_4_2 = "select * from book where 编号 like '"+str5_4_3+"'";
ResultSet rs5_4_2 = stmt5_4_2.executeQuery(sq5_4_2);
if(!rs5_4_2.next())
{
JOptionPane.showMessageDialog(this,"编号错误","错误",JOptionPane.ERROR_MESSAGE);
}
else{
Statement stmt5_4_3 = conn.createStatement(ResultSet.
TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sq5_4_3 = "select 借阅情况,借书ID from book where 借书ID ='"+str5_4_1+"' ";
ResultSet rs5_4_3 = stmt5_4_3.executeQuery(sq5_4_3);
String a=new String("送书");
if((rs5_4_3.next()&&rs5_4_3.getString("借阅情况").equals(a)))
{
JOptionPane.showMessageDialog(this,"此书没有被你所借","错误",JOptionPane.ERROR_MESSAGE);
stmt5_4_3.close();
}
else
{
Statement stmt4_1_54 = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -