难得我今天不愿干其它的活,帮你弄这个,只参照你的代码写的程序,没有参照数据库,部分程序写得太简单,比如修改执行里面,你先去调试一下,把下面所有的代码全部拷贝后新建一文件,文件名:modify.asp,
<% if request("action")="modify" then
Set OBJConn = Server.CreateObject("ADODB.Connection")
OBJConn.Open "dhyx","sa","123456"
sql="select * from sqzz_2 where id= "&id
rs.open sql,OBJConn,1,1
%>
<table border="1">
<form id="form1" name="form1" method="post" action="modify.asp?go=yes&id=<%=rs("id")%>">
<tr>
<td>产品号</td>
<td>产品</td>
<td>件数</td>
<td>批发价</td>
<td>售价</td>
<td>发货人</td>
<td>其他</td>
<td>录入时间</td>
</tr>
<tr>
<%do while not rs.eof%>
<tr>
<td> <input name="11" type="text" id="11" value="<%=rs("bdh")%>"/></td>
<td> <input name="22" type="text" id="22" value="<%=rs("xz")%>" /></td>
<td> <input name="33" type="text" id="33" value="<%=rs("js")%>" /></td>
<td> <input name="44" type="text" id="44" value="<%=rs("bf")%>" /></td>
<td> <input name="55" type="text" id="55" value="<%=rs("bb")%>" /></td>
<td> <input name="66" type="text" id="66" value="<%=rs("sdr")%>" /></td>
<td> <input name="77" type="text" id="77" value="<%=rs("qt")%>" /></td>
<td> <input name="88" type="text" id="88" value="<%=rs("sj")%>" /></td>
</tr>
<tr>
<td colspan="8"><label for="Submit"></label>
<input type="submit" name="Submit" value="提交" id="Submit"></td>
</tr>
</form>
</table>
<%rs.close
set rs=nothing
%>
<%end if%>
<%
'修改记录,执行
if request.form("go")="yes" then
Set OBJConn = Server.CreateObject("ADODB.Connection")
OBJConn.Open "dhyx","sa","123456"
sql="select * from sqzz_2 where id= "&id
rs.open sql,OBJConn,2,3
rs("bdh")=request.form("11")
rs("xz")=request.form("22")
rs("js")=request.form("33")
rs("bf")=request.form("44")
rs("bb")=request.form("55")
rs("sdr")=request.form("66")
rs("qt")=request.form("77")
rs("sj")=request.form("88")
rs.update
rs.close
set rs=nothing
Response.redirect(request.servervariables("http_referer"))
end if
%>
<%
'删除记录执行
if request.form("del")="yes" then
Set OBJConn = Server.CreateObject("ADODB.Connection")
OBJConn.Open "dhyx","sa","123456"
sql="select * from sqzz_2 where id= "&id
rs.open sql,OBJConn,1,3
rs.delete
rs.update
set rs=nothing
Response.redirect(request.servervariables("http_referer"))
end if
%>
再把你上面的代码改成:
<html>
<body>
<table border="1">
<%
Set OBJConn = Server.CreateObject("ADODB.Connection")
OBJConn.Open "dhyx","sa","123456"
sersql="select bdh,xz,js,bf,bb,sdr,qt,sj from sqzz_2 b where sj>=convert(varchar,year(getdate()))+convert(varchar,month(getdate()))+convert(varchar,day(getdate())) and sj<getdate() order by sj desc"
Set rs=OBJConn.Execute (sersql)
%>
<tr>
<td>产品号</td>
<td>产品</td>
<td>件数</td>
<td>批发价</td>
<td>售价</td>
<td>发货人</td>
<td>其他</td>
<td>录入时间</td>
<td> </td>
</tr>
<tr>
<%do while not rs.eof%>
<tr>
<td><%=rs("bdh")%></td>
<td><%=rs("xz")%></td>
<td><%=rs("js")%></td>
<td><%=rs("bf")%></td>
<td><%=rs("bb")%></td>
<td><%=rs("sdr")%></td>
<td><%=rs("qt")%></td>
<td><%=rs("sj")%></td>
<td><a href="modify.asp?action=modify&id=<%=rs("id")%>">修改</a> |<a href="modify.asp?del=yes&id=<%=rs("id")%>">删除</a> </td>
</tr>
</table>
<%
rs.Movenext
loop
%>
<br>
<%
OBJConn.Close
Set rs = Nothing
Set OBJConn = Nothing
%>
</body>
</html>
刚刚这个论坛是不是当了一下,呵呵,访问都访问不了,还那么慢一段时间内…………
[此贴子已经被作者于2006-11-30 17:09:04编辑过]