utilbill.java

来自「spring+struts+hibernate做的银行系统」· Java 代码 · 共 81 行

JAVA
81
字号
/*
 * Created on 2006-4-27
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package cn.com.tym.util.tablebean;


import java.sql.ResultSet;
import java.sql.SQLException;


import cn.com.tym.pub.DB;

import cn.com.tym.table.bean.BillBean;
import cn.com.tym.util.text.DealText;

/**
 * @author jack_booth
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class UtilBill {

	
	 //�鿴����Ĺ��
    
public BillBean getBill(DB db ) throws SQLException
 {
     	     
     
     BillBean  bean=null;
     String strSql = "select top 1 urlPath,urlPhoto,photohight,photoweight from mdh_bill order by bill_id desc";
  
     try
     {
     	ResultSet rs=db.OpenSql(strSql);
        if(rs.next())
         {
              bean=new BillBean();
        
              bean.setUrlPath(rs.getString("urlPath"));
         bean.setUrlPhoto(rs.getString("urlPhoto"));
              bean.setPhotohight(rs.getString("photohight"));
              bean.setPhotoweight(rs.getString("photoweight")); 
         }

     }
     catch(SQLException e)
     {
          e.printStackTrace();
          throw e;
     }
     return bean;
 }
// ������ 
public boolean setBill(String title,String urlPath,String urlPoto,String photohight,String photoweight,DB db)
							throws SQLException{
	boolean bool=false;
	
	
 String strSql="insert into mdh_bill values('"+DealText.dealToSql(title)+"'," +
 											 "'"+DealText.dealToSql(urlPath)+"'," +
 											"'"+DealText.dealToSql(urlPoto)+"'," +
 											"'"+DealText.dealToSql(photohight)+"'," +
 											"'"+DealText.dealToSql(photoweight)+"' )";
 	
 try{
 	 if(db.ExecSql(strSql)!=0){
 	 	bool=true;
 	 }
 	 }catch(SQLException e){
 	 	e.printStackTrace();
 	 	throw e;
 	 }
 	 
 	 return bool;
}
}

⌨️ 快捷键说明

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