String str="select * from tb_user_lt where username='"+username+"'"; 
  ResultSet rs=stmt.executeQuery(str);
  if(!rs.next())
  {
  try
  {
  //通过预处理对象向数据库中添加记录
  PreparedStatement pstmt=con.prepareStatement("insert into tb_user_lt(username,password,nicheng) values(?,?,?)");
  pstmt.setString(1,username);
  pstmt.setString(2,password1);
  pstmt.setString(3,nicheng);
  pstmt.executeUpdate();
  //String str1="insert into tb_user_lt(username,password,nicheng) values";
  //str1=str1+"("+username+","+password1+"'"+nicheng+")";
  //ResultSet rs1=stmt.executeQuery(str1);
  }
  catch(Exception e)
  {
  e.printStackTrace();
  }
  out.println("<script language='javascript'>alert('注册成功!');parent.location.href='login.html';</script>");
      rs.close();
      stmt.close();
      con.close();代码如上所示,运行结果也显示了“注册成功!”,但在数据库中并没有看到添加的记录,这是怎么回事?