急!快来人帮帮忙!一个更新的问题!

mengdizhaoyan 2004-04-22 09:03:30
现在一点头绪都没有,希望大家耐心看看以下代码,其它的都做好了就是更新内容了,帮我写一个修改内容的代码吧,多谢了,完成后我重谢一个小时的时间了。
<!-- #include file="conn.asp"-->
<!-- #include file="virusSearch.asp"-->
<html>
<head>
<meta http-equiv="content-Type" content="text/html;charset=gb2312">
<title>::..-->>病毒防治首页<<--..::</title>
<style>

table{border-color:#99CCFF}
.td{color:#660000}


</style>
<body background="images/bg.gif">
<table align=center>
<tr>
<td align="center"><font color=#FFFF00 face="楷体_GB2312" size=5><b>--->>病毒防治/处理记录<<---</font><b></td>

</tr>
<tr>
<td align="center"><br><font color=#FFFFFF><a href="virus_edit.asp">填写</a></font></td>

</tr>
</table>
<%
Sql = "Select * From virus"
if request("from")="search" then
sql="select * from virus where (1=1) "
if request("StartDate")<>"" then
sql=sql&" and (datas>=#"&request("StartDate")&"#)"
end if
if request("EndDate")<>"" then
sql=sql&" and (datas<=#"&request("EndDate")&"#)"
end if
end if
set rs=Server.CreateObject("adodb.RecordSet")
rs.open sql,conn,1,1
zong=rs.recordcount
rs.pagesize=10
maxpage=rs.pagecount
If rs.EOF then
Response.Write "没有处理过任何病毒呢!"
Else
page=request("p")
if page="" then
page=1
end if
I = (page-1)*10
Response.Write "<table border=1 cellspacing='0' align='center' cellpadding='1'>"
%>
<tr>
<td width=40 height="30">  </td>
<td width=130 height="30" align="center"><b><font color="#FFFFFF">处理时间</font></td>
<td width=120 height="30" align="center"><b><font color="#FFFFFF">处理人员</font></td>
<td width=380 height="30" align=center>
<font color="#FFFFFF"><b>备    注</font></td>
<%if session("username")="admin" then%>
<td width=65><font color="#FFFFFF"> 删除</font></td>
<td width=65><font color="#FFFFFF"> 修改</font></td>
<% end if%>
</tr>

<%
rs.move i
while i<page*10
if not rs.eof then
Response.Write "<tr>"
Response.Write "<td align='center' class='td'>" & I+1 & "</td>"
Response.Write "<td class='td'>" & rs("datas")& "</td>"
Response.Write "<td class='td'>" & rs("ren")& "</td>"
Response.Write "<td class='td' width=280>" & rs("demo")& "</td>"
if session("username")="admin" then
response.Write "<td><font color=#ff0033><a href='delvirus.asp?id="&rs("id")&"'>删除</a></font></td>"
response.Write "<td><font color=#ff0033><a href='updatevirus.asp?id="&rs("id")&"'>修改</a></font></td>"
end if
Response.Write "</tr>"

rs.MoveNext
end if
I = I + 1
Wend
Response.Write "</table>"
End If
%>
<br><hr color="#6699CC" width="800">
<div align="center">
<center>一共有<font size="" color="#FF0000"><%=zong%></font>条记录; 
<td width="431" height="22" align="center">共有 <%=maxpage%> 页 [
<%
For k=1 to maxpage
Response.Write "<a href=virus.asp?p="&k&"&s="&ShowNum&">"&k&"</a> "
Next
%>
]  </td></center>
</div>
<hr color="#6699CC" width="800">
<center><!-- #include file="bottom.asp"--></center>
</body>
</html>
...全文
26 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
mengdizhaoyan 2004-04-22
  • 打赏
  • 举报
回复
<!--#include file="conn.asp"-->
<html>
<head><title></title>
</head>
<body>
<%

IF Session("username")="admin" Then
Set Rs = Server.CreateObject("ADODB.Recordset")
Sql = "Select datas ,ren, demo From virus"
'sql=Update virus set name='xxx',date=#2004-4-20# where id=rs("id")
rs.open sql,conn

end if

%>
<center>
<form action="virus_add.asp?opt=add" name="vrius" method="post">
<table align="center">
<tr><td height=30></td><td></td>
</tr>

<tr>
<td>防治日期</td>
<td><%=date%>
</tr>
<tr>
<td>执行人员</td>
<td><%=session("users")%></td>
</tr>
<tr>
<td valign="top">备    注</td>
<td><textarea rows=5 clos=50 name="memos"><%=rs("demo")%></textarea></td>
</tr>
</table>
<hr width="400">

<input type="submit" name=submit value="更新好了">
</center>
</form>
</body>
</html>
这是我写的我当时知道不对,这样更新的话只能就是穿插了一条新记录,我是想只修改记录,不让他增加成新的记录,这个SQL语句到底怎么写呀,更新语句从没用过呀,难呀。
mengdizhaoyan 2004-04-22
  • 打赏
  • 举报
回复
我现在写了一个不是更新了,倒成了插入新的了,这个SQL难写了,
数据库就是上面几项呀
ID DATAS REN DEMO
1
就是这么个数据库呀
mengdizhaoyan 2004-04-22
  • 打赏
  • 举报
回复
不是错误,没有错误呀,是这个SQL语句不会写了,请帮忙把这个修改这一项的代码简单说一下还了五十分钟了。
whghwujx 2004-04-22
  • 打赏
  • 举报
回复
呵呵,我了,没有什么错误啊,脸红了……

数据库什么内容格式啊,楼主让人家怎么写?晕……
whghwujx 2004-04-22
  • 打赏
  • 举报
回复
<a href='updatevirus.asp?id="&rs("id")&"'>修改</a>或者
<a href="updatevirus.asp?id=<%=rs("id")%>">修改</a>偶习惯于后一种写法,呵呵,
传递ID到updatevirus.asp,在该页进行更新操作,但楼主并没有说什么错误啊
mengdizhaoyan 2004-04-22
  • 打赏
  • 举报
回复
就是上面的这个修改这一项,没有做呢头晕呀。

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧