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

📄 goodinfodes.java

📁 这也是一个源码文件
💻 JAVA
字号:
package goodSearch;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
/**
 * @author snoomy
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 * To enable and disable the creation of type comments go to
 * Window>Preferences>Java>Code Generation.
 */
public class GoodInfoDes implements Serializable {
	public GoodInfoDes(String goodid) {
		this.GoodId = goodid;
		String Name = null, Type = null, Comment = null;
		float price = 0, discount = 0;
		try {
			DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
			String url = "jdbc:oracle:thin:@146.200.51.54:1521:userinfo";
			String search = "select * from goodinfo where GOODID=?";
			Class.forName("oracle.jdbc.driver.OracleDriver");
			Connection jbc = DriverManager.getConnection(url, "sa", "sa");
			PreparedStatement ps;
			ps = jbc.prepareStatement(search);
			ps.setString(1, goodid);
			ResultSet rs = ps.executeQuery();
			while (rs.next()) {
				GoodId = rs.getString("GOODID");
				Type = rs.getString("TYPE");
				Name = rs.getString("NAME");
				price = rs.getFloat("price");
				discount = rs.getFloat("discount");
				Comment = rs.getString("comment");
			}
			ps.close();
			jbc.close();
		} catch (Exception e) {
		}
		this.Comment = Comment;
		this.discount = discount;
		this.Name = Name;
		this.price = price;
		this.Type = Type;
	}
	/**
	 * Constructor GoodInfoDes.
	 */
	public GoodInfoDes() {
	}
	String GoodId, Name, Type, Comment;
	float price, discount;
	/**
	 * Returns the comment.
	 * @return String
	 */
	public String getComment() {
		return Comment;
	}
	/**
	 * Returns the discount.
	 * @return float
	 */
	public float getDiscount() {
		return discount;
	}
	/**
	 * Returns the goodId.
	 * @return String
	 */
	public String getGoodId() {
		return GoodId;
	}
	/**
	 * Returns the name.
	 * @return String
	 */
	public String getName() {
		return Name;
	}
	/**
	 * Returns the price.
	 * @return float
	 */
	public float getPrice() {
		return price;
	}
	/**
	 * Returns the type.
	 * @return String
	 */
	public String getType() {
		return Type;
	}
	/**
	 * Sets the comment.
	 * @param comment The comment to set
	 */
	public void setComment(String comment) {
		Comment = comment;
	}
	/**
	 * Sets the discount.
	 * @param discount The discount to set
	 */
	public void setDiscount(float discount) {
		this.discount = discount;
	}
	/**
	 * Sets the goodId.
	 * @param goodId The goodId to set
	 */
	public void setGoodId(String goodId) {
		GoodId = goodId;
	}
	/**
	 * Sets the name.
	 * @param name The name to set
	 */
	public void setName(String name) {
		Name = name;
	}
	/**
	 * Sets the price.
	 * @param price The price to set
	 */
	public void setPrice(float price) {
		this.price = price;
	}
	/**
	 * Sets the type.
	 * @param type The type to set
	 */
	public void setType(String type) {
		Type = type;
	}
}

⌨️ 快捷键说明

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