[bo][un]nicechlk[/un] 在 2008-10-17 10:42 的发言:[/bo]
是的,2楼说的不错。
看你的代码:
sql="select * from student where username="&id
这个数据库读取格式,说明id是自动编号的,如果id是文本字段,就应该这样:
sql="select * from student where username='" ...
谢谢你,照你所说的去写之前那个问题解决了,我的id是文本字段(username)。
但是现在又面对到另外一个问题了,希望你能再次的帮我看看问题出在哪里吗?
以下是我的modified.asp的代码
<body>
<%
id=request("id")
set rs=server.createobject("adodb.recordset")
sql="select * from student where username='"&id&"'"
rs.open sql,conn,1,3
%>
<h2 align="center">编辑个人资料</h2>
<form name="detail_form" method="post" action="register_process.asp">
<input name="sid" type="hidden" value="<%=rs("id")%>">
<table border="0" align="center" width="80%" background="bg.jpg">
<tr>
<td width="30%"><font color="red">*</font><b>帐号:</b></td>
<td width="70%"><%=rs("username")%></td>
</tr>
<tr>
<td width="30%"><font color="red">*</font><b>新密码:</b></td>
<td width="70%"><input type="password" name="pwd1" size="20"></td>
</tr>
<tr>
<td width="30%"><font color="red">*</font><b>重输新密码:</b></td>
<td width="70%"><input type="password" name="pwd2"></td>
</tr>
<tr>
<td width="30%"><font color="red">*</font><b>名字:</b></td>
<td width="70%"><input type="text" name="F_name" size="20" value="<%=rs("firstname")%>"></td>
</tr>
<tr>
<td width="30%"><font color="red">*</font><b>姓氏:</b></td>
<td width="70%"><input type="text" name="L_name" size="20" value="<%=rs("lastname")%>"></td>
</tr>
<tr>
<td width="30%"><font color="red">*</font><b>性别:</b></td>
<td>
<input type="radio" checked name="P_gender" value="男">
男
<input type="radio" name="P_gender" value="女">
女</td>
</tr>
<tr>
<td width="30%"><font color="red">*</font><b>出生日期:</b></td>
<td>
<select name="birthyear">
<option value=""></option>
<%dim i
for i = 1970 to 2008%>
<option value="<% = i%>"><%=i%></option>
<%next%>
</select>
年
<select name="birthmonth">
<option value=""></option>
<%for i = 1 to 12%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>
月
<select name="birthday">
<option value=""></option>
<%for i = 1 to 31%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>
日
</td>
</tr>
<tr>
<td width="30%"><font color="red">*</font><b>种族</b></td>
<td height="20">
<select name="race">
<option value="">请选择
<option value="">---------------------------
<option value="土族">土族
<option value="Black">Black
<option value="华裔">华裔 (Chinese)
<option value="Eurasion">Eurasion
<option value="印裔">印裔 (Indian)
<option value="巫裔">巫裔 (Malay)
<option value="White">White
<option value="其他">其他
</select>
</td>
</tr>
<tr>
<td width="30%"><font color="red">*</font><b>残障类别:</b></td>
<td width="70%"><input type="text" name="disabled" size="20" value="<%=rs("disability")%>"></td>
</tr>
<tr>
<td width="30%"><font color="red">*</font><b>入学日期:</b></td>
<td>
<select name="enrolyear">
<option value=""></option>
<%dim x
for x = 2005 to 2015%>
<option value="<% = x%>"><%=x%></option>
<%next%>
</select>
年
<select name="e_month">
<option value=""></option>
<%for i = 1 to 12%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>
月
<select name="enrolday">
<option value=""></option>
<%for x = 1 to 31%>
<option value="<%=x%>"><%=x%></option>
<%next%>
</select>
日
</td>
</tr>
<tr>
<td width="30%"><font color="red">*</font><b>毕业日期:</b></td>
<td>
<select name="graduateyear">
<option value="<%=rs("graduateyear")%>"></option>
<%dim y
for y = 2005 to 2015%>
<option value="<% = y%>"><%=y%></option>
<%next%>
</select>
年
<select name="g_month">
<option value=""></option>
<%for i = 1 to 12%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>
月
<select name="graduateday">
<option value=""></option>
<%for y = 1 to 31%>
<option value="<%=y%>"><%=y%></option>
<%next%>
</select>
日
</td>
</tr>
<tr>
<td width="30%"><font color="red">*</font><b>主修课程</b></td>
<td height="20">
<select name="course">
<option value="">请选择
<option value="">---------------------------
<option value="多媒体基础证书">多媒体基础证书
<option value="网页设计高级证书">网页设计高级证书
<option value="动画设计高级证书">动画设计高级证书
</select>
</td>
</tr>
<tr>
<td width="30%"><font color="red">*</font><b>人生目标:</b></td>
<td width="70%"><input type="text" name="goal" size="20" value="<%=rs("goal")%>"></td>
</tr>
<tr>
<td width="30%"><font color="red">*</font><b>电话联络:</b></td>
<td width="70%"><input type="text" name="contact_no" size="20" value="<%=rs("contact number")%>"></td>
</tr>
<tr>
<td width="30%"><font color="red">*</font><b>紧急联络:</b></td>
<td width="70%"><input type="text" name="emergency_no" size="20" value="<%=rs("emergency number")%>"></td>
</tr>
<tr>
<td width="30%"><font color="red">*</font><b>电子邮箱:</b></td>
<td width="70%"><input type="text" name="email" size="20" value="<%=rs("email")%>"></td>
</tr>
<tr>
<td width="30%"><font color="red">*</font><b>地址:</b></td>
<td width="70%"><textarea name="address" rows="10" cols="30" value="<%=rs("address")%>"></textarea></td>
</tr>
<tr>
<td width="30%"></td>
<td width="70%"><input type="submit" value="提交" name="submit"><input type="reset" value="重填" name="reset"></td>
</tr>
</table>
</form>
错误信息
Error Type:
ADODB.Field (0x80020009)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/modified.asp