【Java开源代码栏目提醒】:网学会员为广大网友收集整理了,Arraysql.java,希望对大家有所帮助!
package swing;
import com.bwm.string.Str;
import com.zh.conpool.*;
import java.sql.Connection;
import java.sql.ResultSet;
public class Arraysql{
private ResultSet rs=null;
private String sql="";
private String name="";
Condata con=new Condata();
Connection conn=null;
Str str=new Str();
public ResultSet toRs(){
sql="SELECT * FROM tb_th_types";
try{
con.getConnection();
rs=con.executeQuery(sql);
}catch(Exception eee){
System.out.println(eee.getMessage()+"3333");
}
return rs;
}
public ResultSet toRs(String name){
this.name=name;
sql="SELECT Name,Type FROM tb_th_plan where Name='"+this.name+"' group by Type,Name";
try{
con.getConnection();
rs=con.executeQuery(sql);
}catch(Exception eee){
System.out.println(eee.getMessage()+"3333");
}
return rs;
}
public ResultSet toRst(){
sql="SELECT * FROM tb_th_unit";
try{
con.getConnection();
rs=con.executeQuery(sql);
}catch(Exception eee){
System.out.println(eee.getMessage()+"3333");
}
return rs;
}
public ResultSet toRst(String name){
this.name=name;
sql="SELECT Name,Untils FROM tb_th_plan where Name='"+this.name+"' group by Untils,Name";
try{
con.getConnection();
rs=con.executeQuery(sql);
}catch(Exception eee){
System.out.println(eee.getMessage()+"3333");
}
return rs;
}
public ResultSet toRstb(){
sql="SELECT * FROM tb_th_boss";
try{
con.getConnection();
rs=con.executeQuery(sql);
}catch(Exception eee){
System.out.println(eee.getMessage()+"3333");
}
return rs;
}
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");
}finally{
conn=null;
con=null;
}
}
}