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

📄 words.java

📁 实现图书管理
💻 JAVA
字号:
package mypkg;

import java.util.*;
import java.sql.*;
import java.text.*;

public class words extends Execute_DB
{
	//定义类成员变量
	private long WordID;    
	private String WordContent;   
	private long AuthorID;
	private long BookID;   
	private String CreateTime;
	private String strSql;
	
    
    //初始化类成员变量
	public words()
	{
		this.WordID=0;        
		this.WordContent="";		
		this.BookID=0;	
		this.AuthorID=0;
		java.util.Date NowTime = new java.util.Date();
		this.CreateTime = NowTime.toLocaleString();
		this.strSql=""; 
	}
   
	//向words数据表中添加一条新记录
	public boolean add_word()
	{        
		this.strSql="insert into words ";
		this.strSql=this.strSql + "(";        
		this.strSql=this.strSql + "WordContent,";
		this.strSql=this.strSql + "AuthorID,";
		this.strSql=this.strSql + "BookID,"; 
		this.strSql=this.strSql + "CreateTime";               
		this.strSql=this.strSql + ") ";        
		this.strSql=this.strSql + "values(";
		this.strSql=this.strSql + "'" + this.WordContent + "',";
		this.strSql=this.strSql + "'" + this.AuthorID + "',";
		this.strSql=this.strSql + "'" + this.BookID + "',";	
		this.strSql=this.strSql + "'" + this.CreateTime + "'";
		this.strSql=this.strSql + ")";
		
		boolean isAdd = super.exeSql(this.strSql);		
		return isAdd;
	}    

	//获取成员变量BookID对应图书的所有留言信息,返回一个ResultSet类型对象
	public ResultSet show_words()
	{
		this.strSql="select * from words where BookID = ";
		this.strSql=this.strSql + this.BookID;       
		ResultSet rs = null;              
		try
		{
			rs = super.exeSqlQuery(this.strSql); 
		}
		catch(Exception ex)
		{
			System.out.println(ex.toString());            
		}
		return rs;        
	} 
   
	//设置类成员变量WordID的值 
	public void setWordID(long WordID)
	{
		this.WordID = WordID;	
	}   

	//获取类成员变量WordID的值  
	public long getWordID()
	{
		return this.WordID;	
	} 
	
	 //设置类成员变量WordContent的值 
 	public void setWordContent(String WordContent)
	{
		this.WordContent = WordContent;	
	}   

	//获取类成员变量WordContent的值  
	public String getWordContent()
	{
		return this.WordContent;	
	} 
	
	//设置类成员变量AuthorID的值 
 	public void setAuthorID(long AuthorID)
	{
		this.AuthorID = AuthorID;	
	}   

	//获取类成员变量AuthorID的值  
	public long getAuthorID()
	{
		return this.AuthorID;	
	} 
	
	 //设置类成员变量BookID的值 
 	public void setBookID(long BookID)
	{
		this.BookID = BookID;	
	}   

	//获取类成员变量BookID的值  
	public long getBookID()
	{
		return this.BookID;	
	} 	
	 //设置类成员变量CreateTime的值 
 	public void setCreateTime(String CreateTime)
	{
		this.CreateTime = CreateTime;	
	}   

	//获取类成员变量CreateTime的值  
	public String getCreateTime()
	{
		return this.CreateTime;	
	} 
}

⌨️ 快捷键说明

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