SQL Server实现用户注册
用SQL Server注册用户,通过页面输入注册信息,存储到数据库。
<form action="zhuChe.jsp" method="post" onsubmit="return reg(this);">
<div id="div2">
<p style="margin-left:30px"><img src="data:image/pic_zc.gif"></img></p>
<div style="width:350px;height:20px;margin-left:30px;margin-top:-10px">
<p><hr/></p>
</div>
<p style="margin-left:70px">请填写您的姓名:<input type="text" name="userName"></p>
<p style="margin-left:200px;margin-top:-10px;font-size:12px">请填写有效的Name作为下次登入的用户名,同时我们也会这个地址发送您的账户信息、订单通知等。</p> <p style="margin-left:100px">请设定密码:<input type="password" value="" name="password" datatype="*6-15" errormsg="密码范围在6~15位之间,不能使用空格!" /></p>
<p style="margin-left:35px">请再次输入设定密码:<input type="password" value="" name="repassword" datatype="*" recheck=password" errormsg="您两次输入的账号密码不一致!" /></p> <p style="margin-left:80px">请输入验证码:<input type="text" name="yanz" style="width:50px"></p>
<p style="margin-left:250px;margin-top:-40px;"><img src="data:image/code_img.gif"></img></p>
<p style="margin-left:250px;margin-top:-15px;font-size:12px">看不清换一张</p>
<p style="text-align:center;">请阅读<a href><font color="red" style="font-weight:bold">《"V+网站"服务条款》</font></a></p>
<p style="text-align:center;"><img src="data:image/sumit_bg.gif"></img></p>
<p style="margin-left:129px;font-weight:bold;color:#fff;margin-top:-41px;"><input type="submit" value="同意以上条款并注册" style="color:#8D0223"></p> </div>
<!--右边div框架结束-->
</form>
<%@ 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 进阶 01 数据库的设计
SQL Server 进阶 01 数据库的设计 本篇目录 课程内容回顾及介绍 为什么需要规范的数据库设计 设计数据库的步骤 绘制E-R(实体-关系)图 实体-关系模型 如何将E-R图转换为表 数据规范 ...
- Kerberos和NTLM - SQL Server
当我们使用Windows Authentication去连接SQL Server的时候,SQL Server可能会使用Kerberos或者是NTLM来进行认证,有时间就会因为认证失败的缘故造成各种登录 ...
- [转帖]Kerberos和NTLM - SQL Server
Kerberos和NTLM - SQL Server https://www.cnblogs.com/dreamer-fish/p/3458425.html 当我们使用Windows Authenti ...
- JDBC连接SQL Server数据库
测试环境 数据库:SQL Server 2008 R2,创建数据库名:TestDemo,表:User,字段如下: 字段 字段 id UName UPass sqljdbc.jar下载地址:依赖的J ...
- SQL Server 使用触发器(trigger)发送电子邮件
sql 使用系统存储过程 sp_send_dbmail 发送电子邮件语法: sp_send_dbmail [ [ @profile_name = ] 'profile_name' ] [ , [ @r ...
- SQL SERVER 2008 设置字段默认值为当前时间
在某些情况下需要对某条记录添加上时间戳,比如用户注册,需要记录用户的注册时间,在SQL SERVER 2008中可以通过 1. 添加新字段 2. 数据类型设置为smalldatetime 3. 默认值 ...
- 数据库课程设计:SQL Server + Express + node.js + ejs 论坛管理系统
前言 这是一篇对数据库课程设计的总结,这不是教程也不是指导,只是我的经验之谈,其中可能有许多错误,请小心,不要被误导.祝愿你看了这篇文章后能做出更好的设计. 我对web开发并不熟悉,而我们的课程设计只 ...
- 最近帮客户实施的基于SQL Server AlwaysOn跨机房切换项目
最近帮客户实施的基于SQL Server AlwaysOn跨机房切换项目 最近一个来自重庆的客户找到走起君,客户的业务是做移动互联网支付,是微信支付收单渠道合作伙伴,数据库里存储的是支付流水和交易流水 ...
- SQL Server 大数据搬迁之文件组备份还原实战
一.本文所涉及的内容(Contents) 本文所涉及的内容(Contents) 背景(Contexts) 解决方案(Solution) 搬迁步骤(Procedure) 搬迁脚本(SQL Codes) ...
随机推荐
- C#学习笔记_12_枚举&结构体
12_枚举&结构体 枚举 是一种数据类型 适用于某些取值范围有限的数据 语法: [访问权限修饰符] enum 枚举名 { 枚举值 } 枚举名遵循大驼峰命名法 枚举一般情况下是和switch c ...
- Linux - redis发布|订阅
目录 Linux - redis发布|订阅 发布|订阅 基本命令 发布和订阅实例 正则方式订阅一个或者多个符合模式的频道 Linux - redis发布|订阅 发布: publish 订阅: subs ...
- vue 瀑布流实现
<div class="myWrite" v-if="list.length==0"> - 这个福宝有点懒哦 - </div> < ...
- crontab定时任务安装、使用方法
本文介绍下,在linux中安装crontab的方法,以及crontab的具体用法,有需要的朋友参考下. 这里使用yum方式安装crontab: 复制代码代码示例: [root@CentOS ~]# ...
- OSI七层参考模型每一层都有哪些协议
OSI七层参考模型每一层都有哪些协议 第七层应用层 协议:DHCP • DNS • FTP • Gopher • HTTP • IMAP4 • IRC • NNTP • XMPP • POP3 • S ...
- Servlet中使用getInputStream进行文件上传
据说古老了点,所以代码比较繁琐,主要用于处理文件的地方太多. 下节用SERVLET3.0的Part进行操作一下. form.html: <!DOCTYPE html> <html&g ...
- 洛谷—— P2424 约数和
https://www.luogu.org/problem/show?pid=2424 题目背景 Smart最近沉迷于对约数的研究中. 题目描述 对于一个数X,函数f(X)表示X所有约数的和.例如:f ...
- 高仿京东APP首页“京东快报”自己主动向上滚动的广告条
转载请标明出处: http://blog.csdn.net/hai_qing_xu_kong/article/details/51013562 本文出自:[顾林海的博客] 前言 上次在京东APP上买东 ...
- sleep与信号唤醒的问题 & 内核对信号的处理方式
注意,sleep是会被信号唤醒的. sleep函数:#include <unistd.h>unsigned int sleep(unsigned int seconds);此函数使调用 ...
- Codeforces Round #305 (Div. 2) D题 (线段树+RMQ)
D. Mike and Feet time limit per test 1 second memory limit per test 256 megabytes input standard inp ...