📄 choicetable.java
字号:
/*
* 创建日期 2005-3-11
*
* 更改所生成文件模板为
* 窗口 > 首选项 > Java > 代码生成 > 代码和注释
*/
package jdbc;
import java.sql.*;
/**
* @author Owner
*
* 更改所生成类型注释的模板为
* 窗口 > 首选项 > Java > 代码生成 > 代码和注释
*/
public class ChoiceTable
{
private String command=null;
private Statement statement=null;
public ChoiceTable(Statement statement)
{
this.statement=statement;
}
public int insert(String studentID,int courseID) throws SQLException
{
command="INSERT INTO"+" ChoiceTable" +" VALUES ('"+studentID+"'"+","+courseID+")";
return statement.executeUpdate(command);
}
public int delete(String studentID) throws SQLException
{
command="DELETE FROM ChoiceTable WHERE StudentID='"+studentID+"'";
return statement.executeUpdate(command);
}
public int updateCourseNum(String studentID,int courseNum) throws SQLException
{
command="UPDATE ChoiceTable SET StudentID='"+studentID+"'"+" WHERE CourseNum="+courseNum;
return statement.executeUpdate(command);
}
public ResultSet select(String studentID) throws SQLException
{
if(studentID==null)
command="SELECT * FROM ChoiceTable";
else
command="SELECT * FROM ChoiceTable WHERE StudentID='"+studentID+"'";
return statement.executeQuery(command);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -