<% @ page language = "java" import = "java.util. * " pageEncoding = "utf - 8 " %>
<% @page import = "jdbc.sqlServer" %>
<% @page import = "java.sql.Connection" %>
<% @page import = "java.sql.ResultSet" %>
<% @page import = "java.sql.PreparedStatement" %>
<%
String userName = request.getParameter("userName");
userName = new String( userName.getBytes("ISO - 8859 - 1 "),"utf - 8 ");
String money = request.getParameter(" money ");
String password = request.getParameter("password");
if (userName == null && password == null ){
%> < script type = " text / javascript" >
alert("用户名或密码不为空");
location = "doLog.jsp";
</ script >
<%
}
%>
<%
// 引用连接数据库方法
sqlServer sq = new sqlServer();
// 得到数据库连接
Connection con = sq.getConnection();
// 编写sql语句
String sql = " insert into Admin values (?,?,?)";
// 得到数据库操作对象
PreparedStatement st = con.prepareStatement(sql);
st.setString( 1 ,userName);
st.setInt( 2 , 200 );
st.setString( 3 ,password);
// 得到查询的结果
if (st.executeUpdate() > 0 ){
%>
< script type = " text / javascript" >
alert("注册成功");
location = "LinDao.jsp";
</ script >
<%
} else {
%>
< script language = "javascript" >
function check (){
if (password != password2){
alert("两次密码输入不一致,你看着办吧!");
}
return true;
}
</ script >
<%
}
%>
SQL Server实现用户注册
标签:
查看更多关于SQL Server实现用户注册的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did160899