init_out_in_sql.java

来自「改代码是采用JSP实现的在线办公自动化管理系统」· Java 代码 · 共 76 行

JAVA
76
字号
package swing;

import com.bwm.string.Str;
import com.zh.conpool.*;
import java.sql.Connection;
import java.sql.ResultSet;

public class Init_out_in_sql{
	
	private String sql="";
	private ResultSet rs=null;
	private int del=0;
	private String delid="";
	private String edit="";
	private String[] rest=new String[9]; 
	private String like="";
	
	Condata con=new Condata();
	Connection conn=null;
	Str str=new Str();
	
	public ResultSet toRs(String sqls){
		this.sql=sqls;
		try{
			//sql="select * from tb_th_plan where (Name like '%"+like+"%' and Planing=1)";
			con.getConnection();
			rs=con.executeQuery(sql);
		}catch(Exception eee){
			System.out.println(eee.getMessage());
		}
		return rs;
	}
	
	public String[] toEdit(String edit){
		this.edit=edit;
		try{
			sql="select * from tb_th_plan where ID='"+edit+"'";
			con.getConnection();
			rs=con.executeQuery(sql);
			if(rs.next()){
				rest[0]=rs.getString(2);
				rest[1]=rs.getString(3);
				rest[2]=rs.getString(5);
			}
		}catch(Exception eee){
			System.out.println(eee.getMessage());
		}
		return rest;
	}
	
	public int toDel(String id){
		this.delid=id;
		try{	
			sql="delete from tb_th_plan where ID='"+delid+"'";
			con.getConnection();
			del=con.executeUpdate(sql);
		}catch(Exception eee){
			System.out.println(eee.getMessage());
		}
		return del;
	}
	
	public void close(){
		try{
			conn=null;
		}catch(Exception e){
			System.out.print("f1");
		}
		try{
			con.close();
			con=null;
		}catch(Exception ee){
			System.out.print("f");
		}
	}
}

⌨️ 快捷键说明

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