package com.xk.buss;
import com.xk.db.*;
import com.xk.struts2.action.*;
import java.sql.*;
public class Buss {
public boolean checkLogin(String pwd,String usernmae){
DBConnection dbc=DBConnection.getDB();
Connection conn=null;
PreparedStatement ps=null;
ResultSet re=null;
String sql="select * from emp where pwd='"+pwd+"' and username='"+usernmae+"'";
try {
conn=dbc.getConn();
ps=conn.prepareStatement(sql);
re=ps.executeQuery();
if(re.next()){
return true;
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally{
try {
if(conn!=null){
re.close();
ps.close();
conn.close();
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return false;
}
}
评论3
最新资源