javabean使用有问题 各位大侠帮忙!烦死我了!
ConnectDB
package bbs;
import java.lang.*;
import java.sql.*;
public class ConnectDB {
String url="jdbc:odbc:bbs";
Connection dbConn;
String errMes;
public ConnectDB()
{
errMes="";
dbConn=null;
}
public Connection getConn()
{
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
dbConn=DriverManager.getConnection("jdbc:odbc:bbs","sa","");
}catch(Exception e){
System.out.print(e);
}
return dbConn;
}
public String getErrMes()
{
return errMes;
}
}
package bbs;
import java.lang.*;
import java.sql.*;
public class ExecuteDB extends ConnectDB {
private Connection dbConn;
private Statement stmt;
private ResultSet rs;
private String errMes;
public ExecuteDB() {
dbConn=super.getConn();
stmt=null;
rs=null;
this.errMes=super.getErrMes();
}
public boolean exeSql(String strSql)
{
boolean isSuc=false;
try
{
stmt=dbConn.createStatement();
stmt.executeUpdate(strSql);
stmt.close();
isSuc=true;
}
catch(Exception e)
{
this.errMes=this.errMes+"<br>"+e.toString();
}
return isSuc;
}
public ResultSet exeQuery(String strSql)
{
try
{
stmt=dbConn.createStatement();
rs=stmt.executeQuery(strSql);
}
catch(Exception e)
{
this.errMes=this.errMes+"<br>"+e.toString();
rs=null;
}
return rs;
}
public String getErrMes()
{
return errMes;
}
}
package bbs;
import java.sql.*;
public class User extends ExecuteDB{
private long UserID;
private String UserName;
private String UserPassword;
private String Email;
private String Sex;
private String NickName;
private String CreateTime;
private String Role;
private String strSql;
public User()
{
super();
this.UserID=0;
this.UserName="";
this.UserPassword="";
this.Sex="";
this.NickName="";
this.Role="0";
this.Email="";
java.util.Date NowTime=new java.util.Date();
this.CreateTime=NowTime.toString();
this.strSql="";
}
public void setUserName(String name)
{
this.UserName=name;
}
public void setUserPassword(String password)
{
this.UserPassword=password;
}
public void setSex(String sex)
{
this.Sex=