| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 614 人关注过本帖
标题:[求助]删完所有记录无法正常显示页面??
取消只看楼主 加入收藏
kirind
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2005-10-1
收藏
 问题点数:0 回复次数:1 
[求助]删完所有记录无法正常显示页面??

学ASP一段时间了,自己试着写了段程序,经反复修改,目前还发现下述错误:
1、删除完所有歌曲记录后出现错误,无法正常显示页面。
2、添加歌曲记录时,当歌词栏字数超过50字时页面不能正常显示,歌词栏字数不超过50字时可以正常添加并写入数据库。
3、其他错误尚未发现,欢迎指出。
敬请指教,感激不尽!

程序代码如下:

<!--#include file="conn.asp"-->
<!--#include file="identify.asp"-->
<%
if Request("del")<>"" Then
Sql = "Delete From music2006 Where id="&request("del")
Conn.Execute(Sql)
Response.Redirect "manger.asp"
End if

if Request("action")="edit" then
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="Select * from music2006 where id="&request("id")
rs.Open sql,conn,1,3
rs("filename")=trim(request("filename"))
rs("singer")=trim(request("singer"))
rs("dizi")=trim(request("dizi"))
rs("geci")=trim(request("geci"))
rs.Update
rs.Close
set rs=nothing
Response.Redirect "manger.asp"
end if

if Request("action")="add" then
set rs=server.CreateObject("adodb.recordset")
sql="select * from music2006"
rs.open sql,conn,3,2
rs.addnew
if trim(request.form("filename"))="" then
response.write "<script language=javascript>"
response.write "alert('请填写歌曲名!');"
response.write "</script>"
response.write "<script language=javascript>location='javascript:history.back(1)'</script>"
Response.End
end if
if trim(request.form("singer"))="" then
response.write "<script language=javascript>"
response.write "alert('请填写歌手名!');"
response.write "</script>"
response.write "<script language=javascript>location='javascript:history.back(1)'</script>"
Response.End
end if
if trim(request.form("dizi"))="" then
response.write "<script language=javascript>"
response.write "alert('请填写歌曲地址!');"
response.write "</script>"
response.write "<script language=javascript>location='javascript:history.back(1)'</script>"
Response.End
end if
if trim(request.form("geci"))="" then
response.write "<script language=javascript>"
response.write "alert('请填写歌曲歌词!');"
response.write "</script>"
response.write "<script language=javascript>location='javascript:history.back(1)'</script>"
Response.End
end if
rs("filename")=trim(request("filename"))
rs("singer")=trim(request("singer"))
rs("dizi")=trim(request("dizi"))
rs("geci")=trim(request("geci"))
rs.update
rs.close
response.redirect "manger.asp"
end if
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>管理界面</title>
<style type="text/css">
<!--
a:link {
text-decoration: none;
color: #000000;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: none;
color: #000000;
}
a:active {
text-decoration: none;
color: #000000;
}
body {
margin-top: 0px;
margin-bottom: 0px;
}
-->
</style>
</head>
<body>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="400" height="23" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="397" height="23" bgcolor="#99CC66"><div align="center"><strong>歌&nbsp;曲&nbsp;编&nbsp;辑</strong></div></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"><table width="400" height="22" border="1" cellpadding="0" cellspacing="0" bordercolor="#999966" bgcolor="#FFFFFF">
<tr>
<th width="404" height="20" bgcolor="#99CCCC" scope="col">
<table width="395" border="1" cellpadding="0" cellspacing="0">
<tr bgcolor="#99CCFF">
<td width="70" height="18" align="center"><strong>歌曲名</strong></td>
<td width="46" align="center"><strong>歌手名</strong></td>
<td width="66" align="center"><strong>路径名</strong></td>
<td width="136" align="center"><strong>歌&nbsp;曲&nbsp;词</strong></td>
<td width="65" align="center"><strong>操作类</strong></td>
</tr>

<%strPage=Request.queryString("page")
set rs=Server.CreateObject("adodb.recordset")
sql="SELECT * from music2006 order by id desc"
rs.open sql,conn,1,1
if rs.RecordCount>0 then
sumcount=rs.RecordCount
rs.MoveFirst
end if
rs.PageSize=5
intPageCount=rs.PageCount
if Len(strPage)=0 then strPage="1"
if int(strPage)=<1 then strPage="1"
if int(strPage)>=intPageCount then strPage=intPageCount
rs.absolutepage=cint(strPage)
if rs.bof then
response.Redirect("manger.asp")
end if
for i = 1 to rs.pagesize
%>

<tr>
<form action="manger.asp?action=edit" method="post">
<td width="70" height="18" align="center"><input name="filename" type="text" value="<%=rs("filename")%>" size="10"></td>
<td width="46" align="center"><input name="singer" type="text" value="<%=rs("singer")%>" size="6"><input name="id" type="hidden" id="id" value="<%=rs("id")%>"></td>
<td width="66" align="center"><input name="dizi" type="text" value="<%=rs("dizi")%>" size="9"></td>
<td width="136" align="center"><input name="geci" type="text" value="<%=rs("geci")%>" size="17"></td>
<td width="65" align="center"><input name="Submit" type="submit" class="button1" value="改"><a href="manger.asp?del=<%=rs("id")%>">删</a></td>
</form>
</tr>

<%
rs.movenext
if rs.eof then
i = i + 1
exit for
end if
next
%>

</table>
</tr>
</table></td>
</tr>
<tr>
<td height="21" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="400" height="21" bgcolor="#99CCFF">
<div align="center">
<% response.write "<font>页次:<font class=ver>"&strPage&"</font>/"&intPageCount&"页</font>&nbsp;&nbsp;"
if strPage=1 then
Response.write"首页&nbsp;"
Response.write"上页&nbsp;"
else
Response.write"<a href=manger.asp?page=1>首页</a>&nbsp;"
Response.write"<a href=manger.asp?page="+cstr(strPage-1)+">上页</a>&nbsp;"
end if

if strPage=intPageCount then
Response.write"下页&nbsp;"
Response.write"末页"
else
Response.write"<a href=manger.asp?page="+cstr(strPage+1)+">下页</a>&nbsp;"
Response.write"<a href=manger.asp?page="+cstr(intPageCount)+">末页</a>"
end if
%>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="24" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="400" height="24" bgcolor="#99CC66"><div align="center"><strong>添&nbsp;加&nbsp;新&nbsp;歌</strong></div></td>
</tr>
</table></td>
</tr>
<form action="manger.asp?action=add" method="post" name="form" >
<tr>
<td height="12" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="400" height="12"><table width="400" border="1" cellpadding="0" cellspacing="0" bordercolor="#999966" bgcolor="#FFFFFF">
<tr>
<th width="82" scope="row"> 歌曲信息</th>
<td width="322">&nbsp;歌曲名
<input name="filename" type="text" size="13"> &nbsp;&nbsp;歌手名
<input name="singer" type="text" size="13"></td>
</tr>
<tr>
<th width="82" scope="row">歌曲路径</th>
<td>&nbsp;<input name="dizi" type="text" size="42" value="mp3/.mp3"></td>
</tr>
<tr>
<th width="82" height="109" bgcolor="#FFFFFF" scope="row">歌曲歌词</th>
<td bgcolor="#FFFFFF">&nbsp;<textarea name="geci" cols="41" rows="7">歌曲信息歌曲信息歌曲信息歌曲信息歌曲信息歌曲信息歌曲信息歌曲信息歌曲信息歌曲信息</textarea></td>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>

<% rs.close
set rs=nothing
conn.close
set conn=nothing
%>

<tr>
<td width="410" height="20" bgcolor="#99CC66"><div align="center">
<input type="submit" name="Submit3" value="添加">
&nbsp;&nbsp;&nbsp;
<input type="reset" name="Submit2" value="清除">
</div></td>
</tr>
</form>
<tr>
<td height="20" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="400" height="23" bgcolor="#99CCFF"><div align="center">程序设计:Kirind Studio &nbsp;<a href="index.asp" target="_self">[退出管理]</a></div></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>

搜索更多相关主题的帖子: 页面 记录 
2006-03-02 14:14
kirind
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2005-10-1
收藏
得分:0 
rainic:关于第二个问题,我开始也想到可能是ACCESS文本字段长度的限制,由于我刚学习ASP不久,对数据库操作也比较陌生,请问怎样在数据库里改字段的长度?能不能说详细点。谢谢!
2006-03-02 14:34
快速回复:[求助]删完所有记录无法正常显示页面??
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017361 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved