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

📄 coursetable.java

📁 这是一个可以在手机客户端运行的选课系统 这个是客户端
💻 JAVA
字号:
/*
 * 创建日期 2005-3-11
 *
 * 更改所生成文件模板为
 * 窗口 > 首选项 > Java > 代码生成 > 代码和注释
 */
package jdbc;
import java.sql.*;

/**
 * @author Owner
 *
 * 更改所生成类型注释的模板为
 * 窗口 > 首选项 > Java > 代码生成 > 代码和注释
 */
public class CourseTable
{
	private String command=null;
	private Statement statement=null;
	
	public CourseTable(Statement statement)
	{
		this.statement=statement;
	}
	
	public int insert(int courseID,int number) throws SQLException
	{
		command="INSERT INTO"+" CourseTable" +" VALUES (courseID,number,0)";
		return statement.executeUpdate(command);
	}
	
	public void delete(int courseID) throws SQLException
	{
		if(courseID<0)
			command="DELETE FROM CourseTable";
		else
			command="DELETE FROM CourseTable WHERE CourseID="+courseID;
	    statement.executeUpdate(command);
	}
	
	public void updateIncrease(int courseID) throws SQLException
	{
		command="UPDATE CourseTable SET StudentChosen=StudentChosen+1 WHERE CourseID="+courseID;
       	statement.executeUpdate(command);
	}
	public void updateDecrease(int courseID) throws SQLException
	{
		command="UPDATE CourseTable SET StudentChosen=StudentChosen-1 WHERE CourseID="+courseID;
		statement.executeUpdate(command);
	}
	
	public ResultSet select(int courseID) throws SQLException
	{	
		if(courseID<0)
			command="SELECT * FROM CourseTable";
		else
			command="SELECT * FROM CourseTable WHERE CourseID="+courseID;
	    return statement.executeQuery(command);
	}
}

⌨️ 快捷键说明

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