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

📄 addclass.java

📁 本远程教育系统是采用jsp技术配合SqlServer 2000数据库和Tomcat服务器开发的动态交互式网站。基本实现了用户管理
💻 JAVA
字号:
/*
 *add one classroom into the table classes
 *contains two method:
 *setMode(ClassMode) to get the information of classroom from the classmode
 *add() to insert the information into the table
 */
package condb;
import java.sql.*;
import condb.ConDB;
import condb.ClassMode;
public class AddClass{
	private	String class_id;
	private String class_name;
	private String class_password;
	private String admin_id;
	private String xuanyan;
	public AddClass(){
		class_id = "";
		class_name = "";
		admin_id = "";
		class_password = "";
		xuanyan = "";
	}	
	public void setMode(ClassMode classmode){
		this.class_id = classmode.getClass_id();
		this.class_name = classmode.getClass_name();
		this.class_password = classmode.getClass_password();
		this.admin_id = classmode.getAdmin_id();
		this.xuanyan = classmode.getXuanyan();	
				
	}
	public int add(){
		int i=0;
		String sql = "insert into classes values('"+class_id+"','"
			+class_name+"','"+admin_id+"','"+class_password+"','"+xuanyan+"')";
		ConDB condb = new ConDB();
		Statement stmt = condb.getStmtread();
		try{
			i=stmt.executeUpdate(sql);
		}	
		catch(Exception e){
			System.err.println(e.getMessage());
			e.printStackTrace();
			i--;
		}
		condb.close();
		return i;
	}	
}

⌨️ 快捷键说明

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