标题:看看错在哪里了????
只看楼主
小鼓锤
Rank: 1
等 级:新手上路
帖 子:175
专家分:0
注 册:2005-11-29
 问题点数:0 回复次数:10 
看看错在哪里了????

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/information.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_information_STRING
Recordset1.Source = "SELECT * FROM infor"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META name=VI60_defaultClientScript content=VBScript>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>查询系统</title>
<style type="text/css">
<!--
.style1 {
font-size: 36px;
font-weight: bold;
}
-->
</style>
</head>

<body>
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="100" align="center"><span class="style1">学生信息录入</span></td>
</tr>
</table>
<table width="700" border="1" align="center" cellpadding="0" cellspacing="2" bordercolor="#0066cc">
<tr>
<td width="120" height="28" align="middle">姓 名</td>
<td width="287" align="left" valign="center"><form name="form2" method="post" action="">
<input name="name" id="name"
>
</form></td>
<td width="103" align="middle">出生年月</td>
<td width="170" align="left" valign="center"><form name="form6" method="post" action="">
<input name="birthday" >
</form></td>
</tr>
<tr>
<td height="28" align="middle">性 别</td>
<td align="left" valign="center"><form action="" method="post" name="sex" id="sex">
<p>
<input type="radio" name="sex" value="男">

<input type="radio" name="sex" value="女">
女 </p>
</form></td>
<td align="middle">联系电话</td>
<td align="left" valign="center"><form name="form10" method="post" action="">
<input name="tel" >
</form></td>
</tr>
<tr>
<td height="28" align="middle">政治面貌</td>
<td align="left" valign="center"><form name="form3" method="post" action="">
<select name="zz">
<option value="团员" selected
>团员</option>
<option value="党员">党员</option>
</select>
</form></td>
<td align="middle">学校住址</td>
<td align="left" valign="center"><form name="form11" method="post" action="">
<input name="add" >
</form></td>
</tr>
<tr>
<td height="28" align="middle">辅导员</td>
<td align="left" valign="center"><form name="form4" method="post" action="">
<input name="teach" >
</form></td>
<td colspan="2" rowspan="5" align="middle">&nbsp;</td>
</tr>
<tr>
<td height="28" align="middle">学历</td>
<td align="left" valign="center"><form name="form5" method="post" action="">
<select name="xl">
<option value="大专以下" selected
>大专以下</option>
<option value="大专">大专</option>
<option value="本科">本科</option>
<option value="硕士">硕士</option>
<option value="博士">博士</option>
</select>
</form></td>
</tr>
<tr>
<td height="28" align="middle">专业</td>
<td align="left" valign="center"><form name="form7" method="post" action="">
<input name="career" >
</form></td>
</tr>
<tr>
<td height="28" align="middle">班级</td>
<td align="left" valign="center"><form name="form8" method="post" action="">
<input name="class" >
</form></td>
</tr>
<tr>
<td height="28" align="middle">入学时间</td>
<td align="left" valign="center"><form name="form9" method="post" action="">
<input name="time" >
</form></td>
</tr>
</table>
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><form name="form1" method="post" action="reg.asp">
<input type="submit" name="Submit" value="提交">
<input type="button" name="Submit" value="取消">
</form></td>
</tr>
</table>
<p>


</p>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>

<%
dim strsql,rs
DBPath = Server.MapPath("information.mdb")
set session("rs")=Server.CreateObject("ADODB.Recordset")
rs=Server.CreateObject("ADODB.Recordset")
connstr="provider=microsoft.jet.oledb.4.0;data source="&dbpath
SQL="select * from infor"
session("rs").Open sql,connstr,3,3
rs.addnew
rs("name").value=request.form("name")
rs("sex").value=request.form("sex")
rs("birth").value=request.form("birthday")
rs("zzmm").value=request.form("zz")
rs("teach").value=request.form("teach")
rs("xl").value=request.form("xl")
rs("class").value=request.form("class")
rs("school").value=request.form("school")
rs("addr").value=request.form("add")
rs("tel").value=request.form("tel")
rs("career").value=request.form("career")
rs.Update
Response.Write ("你已经成功注册")
rs.close

conn.close

set rs=nothing

set conn=nothing
%>

搜索更多相关主题的帖子: include file 936 blank target 
2005-12-09 12:47
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
得分:0 
你的代码写得有个性

我是农家的孩子,我有农家孩子的本色!
2005-12-09 12:52
小鼓锤
Rank: 1
等 级:新手上路
帖 子:175
专家分:0
注 册:2005-11-29
得分:0 

<%
Recordset1.Close()
Set Recordset1 = Nothing
%>

<%
dim strsql,rs
DBPath = Server.MapPath("information.mdb")
set session("rs")=Server.CreateObject("ADODB.Recordset")
rs=Server.CreateObject("ADODB.Recordset")
connstr="provider=microsoft.jet.oledb.4.0;data source="&dbpath
SQL="select * from infor"
session("rs").Open sql,connstr,3,3
rs.addnew
rs("name").value=request.form("name")
rs("sex").value=request.form("sex")
rs("birth").value=request.form("birthday")
rs("zzmm").value=request.form("zz")
rs("teach").value=request.form("teach")
rs("xl").value=request.form("xl")
rs("class").value=request.form("class")
rs("school").value=request.form("school")
rs("addr").value=request.form("add")
rs("tel").value=request.form("tel")
rs("career").value=request.form("career")
rs.Update
Response.Write ("你已经成功注册")
rs.close

conn.close

set rs=nothing

set conn=nothing
%>
就看这一部分吧!

2005-12-09 13:14
jayend
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2005-11-22
得分:0 
没有报错吗?是不能运行,还是有错?

2005-12-09 13:27
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
得分:0 
<!-- #include file="conn.asp" -->
<%
name = trim(request("name"))
sex = trim(request("sex"))
birthday = trim(request("birth"))
zz = trim(request("zzmm"))
teach = trim(request("teach"))
xl = trim(request("xl"))
class = trim(request("class"))
..................................
..................................

set rs=server.CreateObject("adodb.recordset")
sql="select * from infor where name = '"&name&"' "
rs.open sql,conn,1,3
if rs.recordcount <> 0 then
response.Write "<script >"
response.Write("alert('对不起!注册不成功!请您换个用户名试试!!');")
response.Write("window.history.back();")
response.Write("</script>")
else
rs.addnew
rs("name") = name
rs("sex") = sex
rs("birth") = birthday
rs("xl") = xl
rs("class") = class
rs("school") = school
..................................

..................................
rs.update
response.Write "<script >"
response.Write("alert('恭喜您!注册成功!!');")
response.Write("window.navigate('........asp')")
response.Write("</script>")
end if
rs.close
set rs = nothing
conn.close
set conn = nothing
%>



但是值得注意,您数据库里的属性一定要和你上面的各属性一定一致,免得注册不成功的。

我提一个不晓得该不该提的建议(是我的爱好):

比如:你上面的属性“生日”——birth,最好和数据库的一致。

也就是说输入框的名称和数据库里的字段属性都用birth,不要用birthday;或是都用birthday,而不要用birth,这样可能不会错一些。


我是农家的孩子,我有农家孩子的本色!
2005-12-09 13:34
小鼓锤
Rank: 1
等 级:新手上路
帖 子:175
专家分:0
注 册:2005-11-29
得分:0 
多谢5楼的老兄,我会改正的.
2005-12-09 18:36
小鼓锤
Rank: 1
等 级:新手上路
帖 子:175
专家分:0
注 册:2005-11-29
得分:0 
我想做的东西和5楼老兄的签名上的东西类似.
5楼的老兄能否大发慈悲,把东东借给俺参考下.小弟不胜感激.!!!!
2005-12-09 18:50
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
得分:0 
你的代码通过了吗?

我是农家的孩子,我有农家孩子的本色!
2005-12-09 19:06
小鼓锤
Rank: 1
等 级:新手上路
帖 子:175
专家分:0
注 册:2005-11-29
得分:0 

但还是不能运行啊!
我真的很郁闷.

能否借鉴下老兄您的.

2005-12-09 19:26
小鼓锤
Rank: 1
等 级:新手上路
帖 子:175
专家分:0
注 册:2005-11-29
得分:0 

但还是不能运行啊!
我真的很郁闷.

能否借鉴下老兄您的.

2005-12-09 19:26



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-37452-1-1.html




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

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