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

hgllucky 2003-08-30 06:18:02
我想把记录删除一条后,仍然停留在这个页面,可是我的程序删除一条记录后,就整个页面全都空了,但是要删除的记录确实删除了,麻烦各位大侠帮我看看?
<%
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>
...全文
40 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
ahuiok 2003-08-31
  • 打赏
  • 举报
回复
你复制我这行代码。

我不知道你的页面还有其他什么原因。我使用下面代码时没有错误。

你可以把rs("编号")赋值给一个变量,语法如下:
bh=rs("编号")
bh=replace('bh',''','"') '屏蔽单引号可能引起的 sql injection 漏洞。
再用下面这段代码试试
aa 参数为上述方法赋值

<a href="#" onClick="javascript:if (confirm('是否确定要删除此条信息?')) href='dhxg1.asp?bh=<%=bh%>&aa=<%=aa%>';
else return;" >删 除</a>
ahuiok 2003-08-30
  • 打赏
  • 举报
回复
你习惯用中文做字段名? 我感觉不太安全,但又说不出理由。
ahuiok 2003-08-30
  • 打赏
  • 举报
回复
<a href="#" onClick="javascript:if (confirm('是否确定要删除此条信息?')) href='dhxg1.asp?bh=<%=rs("编号")%>>'; else return;" >删 除</a>

用这个试试。 如果还有别的参数, 记得要在 dhxg1.asp 后面用&连上。就不会因为参数不足而显示为空了。
possible_Y 2003-08-30
  • 打赏
  • 举报
回复
dhxg1.asp最后加上
response.Redirect "xxxx.asp" '返回xxxx.asp
possible_Y 2003-08-30
  • 打赏
  • 举报
回复
因为点了“删除”后会刷新页面
hgllucky 2003-08-30
  • 打赏
  • 举报
回复
点“删除”链接时,传的bh就在本页dhxg1.asp

28,390

社区成员

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

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