外挂制作教程,vb编写和WPE使用教程. (2008-- 外挂8。0破解版
源代码在线查看: dbconnection.java~14~
package login;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.ResultSet;
public class DBConnection {
private String LoginName;
private String username;
private String PassWord;
private int Age;
private String Address;
Connection con=null;
PreparedStatement pstmt;
public DBConnection (){
}
public String getLoginName() {
return LoginName;
}
public void setLoginName(String LoginName) {
this.LoginName = LoginName;
}
public void setUsername(String username) {
this.username = username;
}
public void setAddress(String Address) {
this.Address = Address;
}
public void setAge(int Age) {
this.Age = Age;
}
public void setPassWord(String PassWord) {
this.PassWord = PassWord;
}
public String getUsername() {
return username;
}
public String getAddress() {
return Address;
}
public int getAge() {
return Age;
}
public String getPassWord() {
return PassWord;
}
public boolean sqlvalidate() throws SQLException {
boolean flag=false;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("Jdbc:Odbc:test", "sa", "");
String strSql="select * from UserInfo where LoginName=? and PassWord=?";
pstmt=con.prepareStatement(strSql);
pstmt.setString(1,getLoginName());
pstmt.setString(2,getPassWord());
ResultSet rs=pstmt.executeQuery();
while(rs.next())
{
flag=true;
}
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
return flag;
}
}