?? productclass.java
字號:
//Source file: D:\work\五洋\javaBean\src\ProductClass.java
package src.wuyang;
import src.com.*;
import java.sql.*;
import java.io.*;
public class ProductClass extends ShangObject
{
/**
產(chǎn)品類別編號
*/
private String classId;
/**
產(chǎn)品類別描述
*/
private String classDesc;
public ProductClass()
{
primarykey1Name = "classId";
primarykey1Type = 1;
tableName = "ProductClass";
viewName = "ProductClass";
numInOnePager = 10;
}
public int loadAttr(){
classId = getRsString(rs,"classId");
classDesc = getRsString(rs,"classDesc");
return 1;
}
public int insert(){
String sql ="insert into ProductClass (classId,classDesc) values (?,?)";
try{
PreparedStatement updStmt = conn.prepareStatement(sql);
setStmtString(updStmt,1,classId);
setStmtString(updStmt,2,classDesc);
updStmt.executeUpdate();
updStmt.close();
return 0;
}catch(SQLException e){
System.out.println(e.getMessage());
e.printStackTrace();
return -1;
}
}
public int update(){
String sql = "update ProductClass set classDesc=? where classId='"
+ classId +"'";
try{
PreparedStatement updStmt = conn.prepareStatement(sql);
setStmtString(updStmt,1,classDesc);
print("sql== " + sql );
updStmt.executeUpdate();
updStmt.close();
return 0;
}catch(SQLException e){
System.out.println(e.getMessage());
e.printStackTrace();
return -1;
}
}
/**
* Access method for the classId property.
*
* @return the current value of the classId property
*/
public String getClassId() {
return classId;}
/**
* Sets the value of the classId property.
*
* @param aClassId the new value of the classId property
*/
public void setClassId(String aClassId) {
try{
classId = new String(aClassId.getBytes("8859_1"));
}catch(UnsupportedEncodingException e) {
System.out.println("error in getbytes");
}
}
/**
* Access method for the classDesc property.
*
* @return the current value of the classDesc property
*/
public String getClassDesc() {
return classDesc;}
/**
* Sets the value of the classDesc property.
*
* @param aClassDesc the new value of the classDesc property
*/
public void setClassDesc(String aClassDesc) {
try{
classDesc = new String(aClassDesc.getBytes("8859_1"));
}catch(UnsupportedEncodingException e) {
System.out.println("error in getbytes");
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -