想修改记录,但却把字段内容变成null了,求解!
一个修改页面mod.asp,通过传递过来的ID读出数据是正常的,但只要读取了这页,无论是否提交表单,数据库中相应ID记录的zds和detail两个字段就会变成null。数据库是SQLServer2000,代码如下:
================================================================
<% Response.Buffer=True %>
<!--#include file= "conn.asp "-->
<%
Id=request( "Id ")
set rs=server.createobject( "adodb.recordset ")
sql= "select * from infodb where Id= " & Id
rs.open sql,conn,3,2
%>
<html>
<head>
<title> </title>
</head>
<body>
<table border= "1 " bordercolordark=#9CC7EF bordercolorlight=#145AA0 cellspacing= "0 " cellpadding= "4 " align= "center " width= "650 " >
<tr>
<td colspan= "2 "> <b> 内容修改 </b> </td>
</tr>
<form method= "POST " action= "mod.asp " name= "addzixun " onSubmit= "return addnew(); ">
<input type= "hidden " name= "Id " size= "20 " value= " <%=Id%> ">
<tr>
<td width= "80 "> 文件编号 </td>
<td>
<input name= "zds " type= "text " id= "zds " size= "20 " value= " <%=rs( "zds ")%> ">
</td>
</tr>
<tr>
<td width= "80 "> 内容 </td>
<td>
<input name= "detail " type= "text " id= "question " size= "60 " value= " <%=rs( "detail ")%> ">
</td>
</tr>
<tr>
<td>
<input type= "submit " value= "确定修改 ">
</td>
</tr>
<%
rs.close
set rs=nothing
%>
</form>
</table>
</body>
</html>
<%
zds=request( "zds ")
detail=re