<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030" import="java.sql.*"%> Insert title here <% try { String username=new String(request.getParameter("username").getBytes("ISO-8859-1"),"GB18030"); String password=new String(request.getParameter("password").getBytes("ISO-8859-1"),"GB18030"); String chepaihao=new String(request.getParameter("chepaihao").getBytes("ISO-8859-1"),"GB18030"); String jine=new String(request.getParameter("jine").getBytes("ISO-8859-1"),"GB18030"); String truename=new String(request.getParameter("truename").getBytes("ISO-8859-1"),"GB18030"); String tel=new String(request.getParameter("tel").getBytes("ISO-8859-1"),"GB18030"); String jianjie=new String(request.getParameter("jianjie").getBytes("ISO-8859-1"),"GB18030"); Connection con=reg.getCon(); String sqlt="select * from reg where username='"+username+"'"; ResultSet rs=reg.GetRs(sqlt); if(rs.next()){ out.println(""); } else { // 添加信息的SQL语句 String sql = "insert into reg(username,password,chepaihao,jine,truename,tel,jianjie,shijian) values('"+username+"','"+password+"','"+chepaihao+"','"+jine+"','"+truename+"','"+tel+"','"+jianjie+"','"+times.showTodayTime()+"')"; int row = reg.GetCount(sql); if(row > 0){ out.println(""); } con.close();} } catch (Exception e) { out.print("注册失败!"); e.printStackTrace(); } %>