| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2902 人关注过本帖
标题:将一个注册表单的数据写入两个数据库。
取消只看楼主 加入收藏
wwm123456789
Rank: 4
等 级:业余侠客
帖 子:63
专家分:204
注 册:2010-4-4
结帖率:92.86%
收藏
已结贴  问题点数:20 回复次数:0 
将一个注册表单的数据写入两个数据库。
程序代码:
<!-- #include file = "../common/site.inc" -->
<%
dim StudentID,name,teacher
StudentID=request.form("StudentID")

 name=request.form("name")

 teacher=request.form("teacher")

 set rs=server.createobject("adodb.recordset")

 sql="select StudentID,name,password,teacher,ph,sfz,bmsj from student where StudentID='"&StudentID&"'"

 rs.open sql,cn,1,1

 if rs.eof then
  response.write "<script>alert('您的学号不存在!');history.back();</script>"
  response.end
  else
    if rs("name")<>name then
      response.write "<script>alert('您的名字与你的学号不匹配!');history.back();</script>"
      response.end
      else
      if rs("password")<>"" then
      response.write "<script>alert('您已经注册,请直接登陆!');history.back();</script>"
      response.end
      else
    if rs("teacher")<>teacher then
      response.write "<script>alert('您的任课教师填写错误!');history.back();</script>"
      response.end
     end if
     end if  
     end if
     end if  
%>
<%
set rs=server.createobject("adodb.recordset")
sql="select StudentID,name,password,teacher,ph,sfz,bmsj from student where StudentID='"&StudentID&"'"
rs.open sql,cn,1,3
name=request.form("name")
password=request.form("password2")
teacher=request.form("teacher")
ph=request.form("ph")
sfz=request.form("sfz")
bmsj=request.form("bmsj")
rs("name")=name
rs("password")=password
rs("teacher")=teacher
rs("ph")=ph
rs("sfz")=sfz
rs("bmsj")=bmsj
rs.update
rs.close
set rs=nothing
cn.close
set rs=nothing
response.write"<script>alert('注册成功,请登陆!');location.href='logon.asp'</script>"
%>
这是将注册信息写入其中一个数据库,如果想同时写入另一个数据库,程序上应该怎么写呢,两个数据库结构和表是一样的,谢谢。
搜索更多相关主题的帖子: 数据库 注册表 color 
2015-01-15 20:58
快速回复:将一个注册表单的数据写入两个数据库。
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017268 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved