Asp:记录修改不了,请帮忙修改 20
文件"edit.asp"<formname="form1"method="post"action="edit1.asp"><inputname="student_num"...
文件"edit.asp"
<form name="form1" method="post" action="edit1.asp">
<input name="student_num " type="text" >
<input type="submit" value="确定"><input type="reset" value="重置">
</form>
文件"edit1.asp"
<!--#include file="conn.asp"-->
<!--#include file="err.asp"--><head>
<meta content="text/html; charset=GB2312">
</head>
<%
exec="select * from students where student_num='"&request.form("student_num")&"'"
set rs=Server.CreateObject("ADODB.Recordset")
rs.open exec,conn
%>
<form name="form1" method="post" action="edit2.asp">
Student_id:
<input name="student_id" type="text" value="<%=rs("student_id")%>">
Student_num:
<input name="student_num" type="text" value="<%=rs("student_num")%>">
<br>
Name:
<input name="name" type="text" value="<%=rs("name")%>">
<br>
Sex :
<input name="sex" type="text" value="<%=rs("sex")%>">
<br>
Age :
<input name="age" type="text" value="<%=rs("age")%>">
<br>
Department :
<input name="department" type="text" value="<%=rs("department")%>">
<br>
Class:
<input name="class" type="text" value="<%=rs("class")%>">
<br>
Address:
<input name="address" type="text" value="<%=rs("address")%>">
<br>
Phone_num:
<input name="phone_num" type="text" value="<%=rs("phone_num")%>">
<br>
<input type="submit" value="提交">
</form>
<%
if Err.Number <> 0 then
Response.clear
Response.write"没有找到符全条件的记录!"
end if
%>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
文件"edit2.asp"
<!--#include file="conn.asp"-->
<%
exec="select* from students where student_num='"&request.form("student_num")&"'"
set rs=Server.CreateObject("ADODB.Recordset")
rs.open exec,conn,1,3
if student_num<>"" then
rs("student_id")=request.form("student_id")
rs("student_num")=request.form("student_num")
rs("name")=request.form("name")
rs("sex")=request.form("sex")
rs("age")=request.form("age")
rs("department")=request.form("department")
rs("class")=request.form("class")
rs("address")=request.form("address")
rs("phone_num")=request.form("phone_num")
rs.update
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write"记录修改成功!"
%> 展开
<form name="form1" method="post" action="edit1.asp">
<input name="student_num " type="text" >
<input type="submit" value="确定"><input type="reset" value="重置">
</form>
文件"edit1.asp"
<!--#include file="conn.asp"-->
<!--#include file="err.asp"--><head>
<meta content="text/html; charset=GB2312">
</head>
<%
exec="select * from students where student_num='"&request.form("student_num")&"'"
set rs=Server.CreateObject("ADODB.Recordset")
rs.open exec,conn
%>
<form name="form1" method="post" action="edit2.asp">
Student_id:
<input name="student_id" type="text" value="<%=rs("student_id")%>">
Student_num:
<input name="student_num" type="text" value="<%=rs("student_num")%>">
<br>
Name:
<input name="name" type="text" value="<%=rs("name")%>">
<br>
Sex :
<input name="sex" type="text" value="<%=rs("sex")%>">
<br>
Age :
<input name="age" type="text" value="<%=rs("age")%>">
<br>
Department :
<input name="department" type="text" value="<%=rs("department")%>">
<br>
Class:
<input name="class" type="text" value="<%=rs("class")%>">
<br>
Address:
<input name="address" type="text" value="<%=rs("address")%>">
<br>
Phone_num:
<input name="phone_num" type="text" value="<%=rs("phone_num")%>">
<br>
<input type="submit" value="提交">
</form>
<%
if Err.Number <> 0 then
Response.clear
Response.write"没有找到符全条件的记录!"
end if
%>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
文件"edit2.asp"
<!--#include file="conn.asp"-->
<%
exec="select* from students where student_num='"&request.form("student_num")&"'"
set rs=Server.CreateObject("ADODB.Recordset")
rs.open exec,conn,1,3
if student_num<>"" then
rs("student_id")=request.form("student_id")
rs("student_num")=request.form("student_num")
rs("name")=request.form("name")
rs("sex")=request.form("sex")
rs("age")=request.form("age")
rs("department")=request.form("department")
rs("class")=request.form("class")
rs("address")=request.form("address")
rs("phone_num")=request.form("phone_num")
rs.update
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write"记录修改成功!"
%> 展开
4个回答
展开全部
if student_num<>"" then '这里是否始终是空的呢?student_num是否被赋值呢
'试下这样:
if not rs.eof then
rs("student_id")=request.form("student_id")
rs("student_num")=request.form("student_num")
rs("name")=request.form("name")
rs("sex")=request.form("sex")
rs("age")=request.form("age")
rs("department")=request.form("department")
rs("class")=request.form("class")
rs("address")=request.form("address")
rs("phone_num")=request.form("phone_num")
rs.update
end if
'试下这样:
if not rs.eof then
rs("student_id")=request.form("student_id")
rs("student_num")=request.form("student_num")
rs("name")=request.form("name")
rs("sex")=request.form("sex")
rs("age")=request.form("age")
rs("department")=request.form("department")
rs("class")=request.form("class")
rs("address")=request.form("address")
rs("phone_num")=request.form("phone_num")
rs.update
end if
展开全部
数据库在,NTFS分区。没有对everyone赋予权限。
或者
rs.open exec,conn,3,3
或者
rs.open exec,conn,3,3
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
s.open exec,conn,1,3
改为:
rs.open exec,conn,3,2
改为:
rs.open exec,conn,3,2
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
在 if student_num<>"" then
rs("student_id")=request.form("student_id")
rs("student_num")=request.form("student_num")
rs("name")=request.form("name")
rs("sex")=request.form("sex")
rs("age")=request.form("age")
rs("department")=request.form("department")
rs("class")=request.form("class")
rs("address")=request.form("address")
rs("phone_num")=request.form("phone_num")
rs.update
中
if student_num<>"" then
student_num根本没有接收到前一个页面的数据
应改位:request.form("student_num")
rs("student_id")=request.form("student_id")
rs("student_num")=request.form("student_num")
rs("name")=request.form("name")
rs("sex")=request.form("sex")
rs("age")=request.form("age")
rs("department")=request.form("department")
rs("class")=request.form("class")
rs("address")=request.form("address")
rs("phone_num")=request.form("phone_num")
rs.update
中
if student_num<>"" then
student_num根本没有接收到前一个页面的数据
应改位:request.form("student_num")
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询