📄 savemodify.java
字号:
package com.ivan.bookManage;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import com.ivan.db.Database;
public class SaveModify
{
public static boolean save(String s[])
{
String isbn = s[0];
String bookname = s[1];
String author = s[2];
String press = s[3];
String edition = s[4];
String type = s[5];
String lang = s[6];
String price=s[7];
String loc = s[8];
String total=s[9];
String sql="update book set bookName='"+bookname+"',"+
"author='"+author+"',"+
"press='"+press+"',"+
"edition='"+edition+"',"+
"type='"+type+"',"+
"language='"+lang+"'," +
"price="+price+",loc='"+loc+"',total="+total+
" where ISBN='"+isbn+"';";
Connection connection;
connection = Database.getConnection(); //建立数据库连接
Statement stmt=null;
try
{
stmt= connection.createStatement();
stmt.executeUpdate(sql);
return true;
}
catch (SQLException e)
{
try
{
connection.rollback();
}
catch (SQLException e1)
{
e1.printStackTrace();
}
e.printStackTrace();
}
finally
{
try
{
connection.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
return false;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -