![]() |
#2
ysf01812015-01-16 14:58
|

<!-- #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>"
%>
这是将注册信息写入其中一个数据库,如果想同时写入另一个数据库,程序上应该怎么写呢,两个数据库结构和表是一样的,谢谢。 <%
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>"
%>