怎样把这些记录一直显示在页面?在线等!

hgllucky 2003-08-31 10:12:11
我想把记录删除一条后,仍然停留在这个页面,可是我的程序删除一条记录后,就整个页面全都空了,但是要删除的记录确实删除了,麻烦各位大侠帮我看看?点“删除”链接时,传的bh就在本页dhxg1.asp

<%
if bh<>"" then
Set conn99 = Server.CreateObject("ADODB.Connection")
conn99.Open "Driver=SQL Server;Server=192.222.34.56;UID=hgx;PWD=hgx;Database=whpg"
Set myrst99=Server.CreateObject("ADODB.Recordset")
sql99="select * from 电话登记表 where 编号='" & bh & "'"
myrst99.open sql99,conn99,3,3
if myrst99.recordcount>0 then
myrst99.delete
myrst99.update
myrst99.close
set myrst99=nothing
end if
conn99.close
set conn99=nothing
end if
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Driver=SQL Server;Server=192.222.34.56;UID=hgx;PWD=hgx;Database=whpg"
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from 电话登记表 where 接电人='" & uid & "' and 来电日期>='" & date1 & "' and 来电日期<='" & date2 & "' "
rs.open sql,conn,1,1
if rs.recordcount>0 then
%>
</font>
<table align="center" border="1" cellpadding="0" cellspacing="0" >
<tr>
<td> <font face="宋体"> 厂址  </font></td>

<td><font face="宋体">紧急程度  </font></td>

<td><font face="宋体">来电单位 </font></td>

<td ><font face="宋体">来电人 </font></td>

<td><font face="宋体">主机编号 </font></td>
<td> </td>
<td> </td>
</tr>
<%
do while not rs.eof
%>
<tr>
<td> <font face="宋体"> <%=rs("厂址")%></a></font></td>
<td> <font face="宋体"> <%=rs("紧急程度")%> </font></td>

<td><font face="宋体"> <%=rs("来电单位")%> </font></td>
<td ><font face="宋体"> <%=rs("来电人")%> </font></td>
<td ><font face="宋体"> <%=rs("来电电话")%> </font></td>
<td >font face="宋体"> <%=rs("主机编号")%> </font></td>
<td ><font face="宋体">
<a href="dhxg2.asp?bh=<%=rs("编号")%>">修改</a> </font></td>
<td><font face="宋体">
<a href="dhxg1.asp?bh=<%=rs("编号")%>">删除</a> </font></td>
</tr>
<%
rs.movenext
loop
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%>
</table>
</form>
...全文
41 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
lions911 2003-08-31
  • 打赏
  • 举报
回复
在完成删除之后:

response.write("<Script>alert('删除成功~~!');location.href='dhxg1.asp'</Script>")
response.end
bigspook 2003-08-31
  • 打赏
  • 举报
回复
就是,把删除操作放到另一个页面去完成多清晰呀!
删除页面只执行操作,不让它显示,执行完操作再REDIRECT回来不是很好吗?
奇玉 2003-08-31
  • 打赏
  • 举报
回复
我做时一般是去另一个页面进行删除操作,然后再刷新本页面
pazll 2003-08-31
  • 打赏
  • 举报
回复
我靠,不是吧,你怎么一个页面开开关关数据库那么多次啊;
你不嫌嘛烦吗?
删除之后要停留在页面,其实你已经做到了啊;
就那样,不过,建议你最好不要那样连接数据库,太化不来了;


gdcrx 2003-08-31
  • 打赏
  • 举报
回复
检查一下您下面的记录集有没有返回记录
sql="select * from 电话登记表 where 接电人='" & uid & "' and 来电日期>='" & date1 & "' and 来电日期<='" & date2 & "' "
rs.open sql,conn,1,1
response.write rs.recordCount

如果没有符合条件的记录,当然就不显示了。

你可以移动一下如下 if rs.recordcount>0 then


<table align="center" border="1" cellpadding="0" cellspacing="0" >
<tr>
<td> <font face="宋体"> 厂址  </font></td>

<td><font face="宋体">紧急程度  </font></td>

<td><font face="宋体">来电单位 </font></td>

<td ><font face="宋体">来电人 </font></td>

<td><font face="宋体">主机编号 </font></td>
<td> </td>
<td> </td>
</tr>
<%
if rs.recordcount>0 then

do while not rs.eof
%>
<tr>
<td> <font face="宋体"> <%=rs("厂址")%></a></font></td>
<td> <font face="宋体"> <%=rs("紧急程度")%> </font></td>

<td><font face="宋体"> <%=rs("来电单位")%> </font></td>
<td ><font face="宋体"> <%=rs("来电人")%> </font></td>
<td ><font face="宋体"> <%=rs("来电电话")%> </font></td>
<td >font face="宋体"> <%=rs("主机编号")%> </font></td>
<td ><font face="宋体">
<a href="dhxg2.asp?bh=<%=rs("编号")%>">修改</a> </font></td>
<td><font face="宋体">
<a href="dhxg1.asp?bh=<%=rs("编号")%>">删除</a> </font></td>
</tr>
<%
rs.movenext
loop
else %>
<tr> <td>没有找到记录</td></tr>

<%
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%>
</table>

hgllucky 2003-08-31
  • 打赏
  • 举报
回复
上面的方法我都试了,还是不行呀
aspsun 2003-08-31
  • 打赏
  • 举报
回复
if myrst99.recordcount>0 then
myrst99.delete
myrst99.update
myrst99.close
set myrst99=nothing
end if
conn99.close
set conn99=nothing
end if
后面添加
response.write("<Script>alert('删除成功~~!');location.href='dhxg1.asp'</Script>")
response.end
wggipkhgef 2003-08-31
  • 打赏
  • 举报
回复
if myrst99.recordcount>0 then
myrst99.delete
myrst99.update
myrst99.close
set myrst99=nothing
end if
conn99.close
set conn99=nothing
end if
后面添加
response.redirect"dhxg1.asp"

28,390

社区成员

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

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