asp错误
<% @language="vbscript" %>
<!--#include file="conn.asp"-->
<%
Function ListError(marray)
f_marray=split(marray,"|",-1,1)
for i=0 to ubound(f_marray)-1
Str=str&(i+1)&"、"&f_marray(i)&"<br>"
next
ListError=Str
end Function
userid=request("userid")
password=request("password")
name=request("name")
email=request("email")
if request("register")<>"" then
a_str="qwertyuiopasdfghjklzxcvbnmQWERYTUIOPASDFGHJKLZXCVBNM1234567890_"
err_str=""
if userid<>"" then
for i=1 to len(userid)
if instr(a_str,mid(userid,i,1))=0 then
err_str=err_str&"登录账号的输入值出错|"
exit for
end if
next
end if
if password="" then err_str=err_str&"密码不能为空值|"
if password<>request("cnpwd") then err_str=err_str&"密码与确认密码不同,请重新输入|"
if name="" then err_str=err_str&"真实姓名不能为空值|"
if email="" then err_str=err_str&"email不能为空值|"
if instr(email,"@")=0 or instr(email,"@")=1 or instr(email,"@")=len(email) then
err_str=err_str&"email出错|"
elseif instr(email,".")=0 or instr(email,".")=1 or instr(email,".")=len(email) or instr(email,".")<instr(email,"@") then
err_str=err_str&"email出错|"
end if
Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = Conn
'set rs=Server.CreateObject("ADODB.connection")
rs.open "SELECT * FROM member",conn,3,2
b_str="register|cnpwd|submit2"
if err_str=err_str&"" then
for each keystr in request.form
if instr(b_str,keystr)=0 and request(keystr)<>"" then
rs.fields(keystr)=request(keystr)
end if
next
rs.update
end if
rs.close
response.redirect "index.htm"
end if
%>
<html>
<head>
<title>注册</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="friend.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="770" border="0" cellspacing="0" cellpadding="0" class="font10">
<tr>
<td><b><font color="#6666FF">个人资料注册</font></b>
<%
'如果注册信息中有错误就显示出错误
if err_str<>"" then
%>
<div id="Layer1" style="position:absolute; width:182px; height:189px; z-index:1; left:10px; top:44px"><font color="#FF0000"><b>错误: <br>
</b><%=ListError(err_str)%></font>
<%
end if
%>
</div>
</td>
</tr>
<tr>
<td bgcolor="#336699"></td>
</tr>
<tr>
<td><br>
<table width="500" border="0" align="center" cellspacing="0" cellpadding="0" class="font10">
<form name="form1" method="post" action="">
<tr>
<td width="118" align="right"><font color="<% if instr(h_error,",1,")<>0 then response.write "#FF0000"%>">登录账号: </font></td>
<td width="382">
<input type="text" name="userid" size="20" maxlength="10"
value="<%=userid%>">
<font color="#FF0000">*</font></td>
</tr>
<tr>
<td width="118" align="right"><font color="<% if instr(h_error,",2,")<>0 then response.write "#FF0000"%>">密码: </font></td>
<td width="382">
<input type="password" name="pwd" size="20" maxlength="10"
value="<%=password%>">
<font color="#FF0000">*</font></td>
</tr>
<tr>
<td width="118" align="right"><font color="<% if instr(h_error,",2,")<>0 then response.write "#FF0000"%>">确定密码: </font></td>
<td width="382">
<input type="text" name="cnpwd" size="20" maxlength="10"
value="<%=cnpwd%>">
<font color="#FF0000">*</font></td>
</tr>
<tr>
<td width="118" align="right">性别: </td>
<td width="382">
<input type="radio" name="gender" value="1" checked>
男
<input type="radio" name="gender" value="0" <% if gender="0" then response.write "checked"%>>
女</td>
</tr>
<tr>
<td width="118" align="right"><font color="<% if instr(h_error,",5,")<>0 then response.write "#FF0000"%>">电子邮件: </font></td>
<td width="382">
<input type="text" name="email" size="50"
value="<%=email%>">
<font color="#FF0000">*</font></td>
</tr>
<tr>
<td width="118" align="right"><font color="<% if instr(h_error,",3,")<>0 then response.write "#FF0000"%>">真实姓名: </font></td>
<td width="382">
<input type="text" name="name" size="20" maxlength="10"
value="<%=name%>">
<font color="#FF0000">*</font></td>
</tr>
<tr>
<td width="118" align="right">身份证号: </td>
<td width="382">
<input type="text" name="idcard" size="50"
value="<%=idcard%>">
</td>
</tr>
<tr>
<td width="118" align="right"><font color="<% if instr(h_error,",5,")<>0 then response.write "#FF0000"%>">密码问题: </font></td>
<td width="382">
<input type="text" name="question" size="50"
value="<%=question%>">
</td>
</tr>
<tr>
<td width="118" align="right"><font color="<% if instr(h_error,",5,")<>0 then response.write "#FF0000"%>">密码答案: </font></td>
<td width="382">
<input type="text" name="answer" size="50"
value="<%=answer%>">
</td>
</tr>
<tr>
<td width="118" align="right">所在省份: </td>
<td width="382">
<select name="province">
<option value=1>北京</option>
<option value=2>上海</option>
<option value=3>天津</option>
<option value=4>重庆</option>
<option value=5>广东</option>
<option value=6>浙江</option>
<option value=7>湖南</option>
<option value=8>江西</option>
<option value=9>四川</option>
<option value=10>山东</option>
<option value=11>辽宁</option>
<option value=12>湖北</option>
<option value=13>山西</option>
<option value=14>陕西</option>
<option value=15>广西</option>
</select>
</td>
</tr>
<tr>
<td width="118" align="right">主页</td>
<td width="382">
<input type="text" name="homepage" size="50" value="<%=homepage%>">
</td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<input type="submit" name="register" value="确定提交">
<input type="reset" name="submit" value="重新再填">
</div></td>
</tr>
<tr>
<td width="118"> </td>
<td width="382"> </td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</body>
</html>
运行后不成功,提示HTTP 错误 404 - 文件或目录未找到。我用的是Acess连接,conn.asp代码如下:
<%
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("Member.mdb")
Conn.Open
%>
问题点数:10、回复次数:21Top
1 楼moodboy1982(老鹰)回复于 2006-05-03 19:26:40 得分 0
用排除法把怀疑的代码移去。再试。
-----------个性签名------------
http://www.esoftnow.com/bbsTop
2 楼chqsll707()回复于 2006-05-03 19:32:37 得分 0
已经用排除法试过了,是不是把显示友好错误勾掉,我已经勾选掉了Top
3 楼jobs002(Oh! Office)回复于 2006-05-03 19:35:21 得分 0
<!--#include file="conn.asp"-->
conn.asp是不是和文件同一目录???...............Top
4 楼chqsll707()回复于 2006-05-03 19:45:36 得分 0
是,在同一个目录下Top
5 楼mysqlaping(处女主任的兄弟)回复于 2006-05-03 21:05:35 得分 0
服务器配置问题吧,要支持asp才可以的。Top
6 楼chqsll707()回复于 2006-05-03 21:29:28 得分 0
这些都没问题的,我不至于连这个也不清楚啊,支持ASP而已Top
7 楼heroooooo(学习.NET)回复于 2006-05-03 21:47:11 得分 0
我敢打赌是楼主的目录没有放对,你不用先把代码搞得这么复杂,最简单的一个asp代码看你的IIS是否设置正确了..Top
8 楼chqsll707()回复于 2006-05-03 22:00:46 得分 0
可以的,我试过了,IIS没有问题Top
9 楼heroooooo(学习.NET)回复于 2006-05-03 22:20:48 得分 0
只是不知道你说的"我试过了,IIS没有问题",你是怎么试的??有没有将一个asp文件成功的执行了???Top
10 楼chqsll707()回复于 2006-05-03 22:39:25 得分 0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body bgcolor="#FFFFFF">
<%
Response.Write"当前的服务器的时间是:"
Response.Write Now
%>
</body>
</html>
运行结果:当前的服务器的时间是:2006-5-3 22:37:58
IIS有问题吗?我不至于没清楚情况就发贴吧Top
11 楼heroooooo(学习.NET)回复于 2006-05-03 22:49:53 得分 0
再仔细的看了看你的贴子,觉得应该是没有什么问题的,最后一个问题:你写的那个程序和刚才你测试的那个程序是在同一目录吗??
ps:有时候用IE执行的时候,记得刷新一下,IE有记忆功能的,若所有的这些都解决了,我就无话可说,现在还没有见过这么过错误,感觉就是不可能.... 有错误不要紧,关键是怎么提示这么个错误了???你再好好的看看,我等,11点关灯..Top
12 楼heroooooo(学习.NET)回复于 2006-05-03 22:54:59 得分 0
好了,不等了,明天再说了Top
13 楼jhp604()回复于 2006-05-03 23:13:09 得分 0
欢迎加群
名字:网站建设
群号:21637188Top
14 楼chqsll707()回复于 2006-05-04 07:18:44 得分 0
我写的程序跟刚才测试的那上是放在同一个目录下的,重新执行的时候我对IIS都重新直启动或刷新过,应该是不存在问题的,这程序我以前用SQL SERVER测试的时候可以的,现在用ACCESS连接,因为对这个我不懂,所以不知道错在哪里.Top
15 楼chqsll707()回复于 2006-05-04 07:44:29 得分 0
问题解决了,发现注册后的内容也写进数据库了,但存在两个问题,密码部分没有改变,还有后一次的注册内容直接把上一次的注册内容覆盖掉了,这又应该如何解决?Top
16 楼heroooooo(学习.NET)回复于 2006-05-04 07:47:24 得分 0
刚才又在本地测试了下,错误提示是"错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver]常见错误 不能打开注册表关键字 'Temporary (volatile) Jet DSN for process 0xf4c Thread 0xcc4 DBC 0x57a0064 Jet'。
/myweb/conn.asp, 第 6 行
"
你再好好看你的程序吧,程序名称最好不用是中文的,大小写问题.我连接数据库的方式一般都不是这样的,你的连接方式好象有问题,自己再好好的看看..将你的程序好好的看了看,在本地建了一个新的数据库.Top
17 楼heroooooo(学习.NET)回复于 2006-05-04 07:49:16 得分 0
再开一个话题吧,分少了没有人回答的,将你的原因贴出来吧,不过我估计就是我上面说的那些原因..Top
18 楼wangcaiwen()回复于 2006-05-04 12:14:02 得分 0
对于0x80004005的问题
要设置ACCESS数据库的访问权限
设置成everyone完全控制
这是ACCESS和SQL中的不同
Top
19 楼wangcaiwen()回复于 2006-05-04 15:50:34 得分 0
引用: chqsll707()
------------------------------
问题解决了,发现注册后的内容也写进数据库了,但存在两个问题,密码部分没有改变,还有后一次的注册内容直接把上一次的注册内容覆盖掉了,这又应该如何解决?
------------------------------
没注意上个问题不是你问的
对你你这个问题,我大致浏览了一下你上面的代码
原因应该是你根本没有写入新数据,只是用Update更新数据而已,如果需要插入新数据是:
Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = Conn
'set rs=Server.CreateObject("ADODB.connection")
rs.open "SELECT * FROM member",conn,3,2
b_str="register|cnpwd|submit2"
if err_str=err_str&"" then
for each keystr in request.form
if instr(b_str,keystr)=0 and request(keystr)<>"" then
rs.addnew
'-------------------------------------------插入新数据
rs.fields(keystr)=request(keystr)
end if
next
rs.update
end if
rs.close
response.redirect "index.htm"
end if
Top
20 楼chqsll707()回复于 2006-05-04 16:02:05 得分 0
这样我试了,数据是插进去了,可是在表中的显示就是每一条记录只显示一个字段,就像名称字体显示一个,接下来下一行密码字段显示一个,像阶梯似的显示了Top
21 楼wangcaiwen()回复于 2006-05-04 18:43:00 得分 0
呵呵
是我搞错了
你应该将rs.Addnew入在循环之外
不好意思
早上整家务整的人郁闷死了
Top




