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

📄 words.java

📁 一个网购物系统有JAVA 写成...稍加修改就可以成为毕业设计用..希望对你们有用
💻 JAVA
字号:
package com.wssd;

import java.sql.*;

public class Words extends ExecuteDB
{
	//定义类成员变量
	private long WordsID;
	private String Content; 
	private long UserID;  
	private long WareID;   
	private String CreateTime;   
	private String strSql;
   
    //构造函数,对成员变量进行初始化赋值
	public Words()
	{       
		this.WordsID=0;
		this.Content="";        
		this.WareID=0;
		this.UserID=0;                      
		java.util.Date NowTime = new java.util.Date();
		this.CreateTime = NowTime.toLocaleString();                    
		this.strSql="";
	}
   
	//添加新留言,往words数据表中添加一条新记录
	public boolean add()
	{	
		this.strSql="insert into words ";
		this.strSql=this.strSql + "(Content,UserID,WareID,CreateTime)";		
		this.strSql=this.strSql + "values('" + this.Content + "','" + this.UserID + "','" + this.WareID + "','" + this.CreateTime + "')";		
		boolean isAdd = super.exeSql(this.strSql);
		
		return isAdd;
	}	
   
  	//获取WordsID对应的留言信息,将这些信息赋值给相应的类变量
	public boolean init()
	{
    	this.strSql="select * from `words` where WordsID=";
        this.strSql=this.strSql + "'" + this.WordsID + "'";        
		try
		{
   			ResultSet rs = super.exeQuery(this.strSql);
			if (rs.next())
			{
                WordsID=rs.getLong("WordsID");
                Content=rs.getString("Content");
                WareID=rs.getLong("WareID");
                UserID=rs.getLong("UserID"); 
                CreateTime=rs.getString("CreateTime");
                return true;
			}
			else
				return false;
		}
		catch(Exception e)
		{
			return false;
		}        
	}

	//获得WareID对应的一组留言信息,返回一个ResultSet类型对象
	public ResultSet show_words()
	{	
		this.strSql="select * from `words`";
        this.strSql=this.strSql + " where WareID = '" + this.WareID + "'";        
		ResultSet rs = null;              
		try
		{
			rs = super.exeQuery(this.strSql); 
		}
		catch(Exception e)
		{
			System.out.println(e.toString()); 
		}
		return rs;	    
	}

	//设置类成员变量WordsID的值
	public void setWordsID(long WordsID)
	{
		this.WordsID = WordsID;	
	}
   
	//获取类成员变量WordsID的值  
	public long getWordsID()
	{
		return this.WordsID;	
	}

	//设置类成员变量Content的值  
 	public void setContent(String Content)
	{
		this.Content = Content;	
	}
   
	//获取类成员变量Content的值  
	public String getContent()
	{
		return this.Content;	
	}

	//设置类成员变量UserID的值 
	public void setUserID(long UserID)
	{
		this.UserID = UserID;	
	}

	//获取类成员变量UserID的值  
	public long getUserID()
	{
		return this.UserID;	
	}

	//设置类成员变量WareID的值  
 	public void setWareID(long WareID)
	{
		this.WareID = WareID;	
	}
   
	//获取类成员变量WareID的值  
	public long getWareID()
	{
		return this.WareID;	
	}

 	//设置类成员变量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 + -