当前位置: 技术问答>java相关
关于数据库查询的java递归程序怎么写?最好有例子
来源: 互联网 发布时间:2015-06-10
本文导语: 关于数据库查询的java递归程序怎么写?最好有例子,谢谢! | public class AddRole { Connection con=null; Vector vu=null; public AddRole() { con=Pub.connectBase(); User us=...
关于数据库查询的java递归程序怎么写?最好有例子,谢谢!
|
public class AddRole {
Connection con=null;
Vector vu=null;
public AddRole() {
con=Pub.connectBase();
User us=new User();
us.connectDatabase();
vu=us.getAllUser();
us.closeDatabase();
}
public Vector addView(String dirCode){
String sql="select DirId from T_OA_DirInfo where MasDir=?";
Vector vv=new Vector();
PreparedStatement ps=null;
ResultSet rs=null;
try{
ps=con.prepareStatement(sql);
ps.setString(1,dirCode);
rs=ps.executeQuery();
while(rs.next()){
vv.add(rs.getString(1));
rs.close();
ps.close();
}catch(Exception ex){
System.out.println(ex);
}finally{
return vv;
}
}
public void addUser(String dirId){
PreparedStatement pst=null;
String sq="Insert into docViewRole (userId,DirId ) Values ";
sq=sq+" (?,?)";
for(int j=0;j
Connection con=null;
Vector vu=null;
public AddRole() {
con=Pub.connectBase();
User us=new User();
us.connectDatabase();
vu=us.getAllUser();
us.closeDatabase();
}
public Vector addView(String dirCode){
String sql="select DirId from T_OA_DirInfo where MasDir=?";
Vector vv=new Vector();
PreparedStatement ps=null;
ResultSet rs=null;
try{
ps=con.prepareStatement(sql);
ps.setString(1,dirCode);
rs=ps.executeQuery();
while(rs.next()){
vv.add(rs.getString(1));
rs.close();
ps.close();
}catch(Exception ex){
System.out.println(ex);
}finally{
return vv;
}
}
public void addUser(String dirId){
PreparedStatement pst=null;
String sq="Insert into docViewRole (userId,DirId ) Values ";
sq=sq+" (?,?)";
for(int j=0;j