MyException - 我的异常网
当前位置:我的异常网» Java Web开发 » javabean使用有有关问题 各位大侠帮忙!烦死我了

javabean使用有有关问题 各位大侠帮忙!烦死我了(2)

www.MyException.Cn  网友分享于:2013-12-24  浏览:5次

  }
  public void setEmail(String email)
  {
  this.Email=email;
  }








  public boolean add()
  {
  this.strSql="insert into users (UserName,UserPassword,Email,Sex,NickName,CreateTime) ";
  this.strSql=" values('"+UserName+"','"+UserPassword+"','"+Email+"','"+Sex+"','"+NickName+"')";
  boolean isAdd=super.exeSql(this.strSql);
  return isAdd;
  }
  public boolean modify_info()
  {
  this.strSql="update users set";
  this.strSql=this.strSql+"Email="+"'"+this.Email+"',";
  this.strSql=this.strSql+"Sex="+"'"+this.Sex+"',";
  this.strSql=this.strSql+"NickName="+"'"+this.NickName+"',";
  this.strSql=this.strSql+"Create="+"'"+this.CreateTime+"',";
  this.strSql=this.strSql+"where UserID='"+this.UserID+"'";
  boolean isUpdate=super.exeSql(this.strSql);
  return isUpdate;
  }
  public boolean modify_UserPassword()
  {
  this.strSql="update users set";
  this.strSql=this.strSql+"UserPassword="+"'"+this.UserPassword+"'";
  this.strSql=this.strSql+"where UserID='"+this.UserID+"'";
  boolean isUpdateKey=super.exeSql(this.strSql);
  return isUpdateKey;
  }
  public boolean init()
  {
  this.strSql="select * from 'users' where UserID=";
  this.strSql=this.strSql+"'"+this.UserID+"'";
  try
  {
  ResultSet rs=super.exeQuery(this.strSql);
  if(rs.next())
  {
  this.UserID=rs.getLong("UserID");
  this.UserName=rs.getString("UserName");
  this.UserPassword=rs.getString("UserPassword");
  this.Sex=rs.getString("Sex");
  this.NickName=rs.getString("NickName");
  this.Email=rs.getString("Email");
  this.CreateTime=rs.getString("CreateTime");
  return true;
  }
  else
  {
  return false;
  }
  }catch(Exception e)
  {
  System.out.println(e.toString());
  return false;
  }
  }
  public boolean valid()
  {
  this.strSql="select UserID,UserName,Role from 'users'";
  this.strSql=this.strSql+" where UserName='"+this.UserName+"'";
  this.strSql=this.strSql+" and UserPassword='"+this.UserPassword+"'";
  System.out.println(this.strSql);
  try
  {
  ResultSet rs=super.exeQuery(this.strSql);
  if(rs.next())
  {
  this.UserID=rs.getLong("UserID");
  this.UserName=rs.getString("UserName");
  this.Role=rs.getString("Role");
  return true;
  }
  else
  {
  return false;

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有