请教一个关于网页数据传递的问题
数据库表中notice表中有‘nclass’字段,字段值皆为中文,如‘新闻’,在通过‘notice.asp?nclass=新闻'数据传递时,notice.asp文件查找不到nclass为‘新闻’的记录,但通过‘noticeadd.asp?nclass=新闻’数据能够添加进表中。百思不得其解,望高手指教为谢。 问题点数:20、回复次数:4Top
1 楼super_paladin(成熟给我们的不是越来越懂得珍惜 而是越来越懂得放弃)回复于 2006-03-04 17:48:02 得分 0
检查你的sql语句,查不出来的话就把它贴出来让大家帮你看下.Top
2 楼nivzgdo(时代先锋)回复于 2006-03-04 17:56:26 得分 0
“notice.asp?nclass=新闻”传递时,下面不显示表中的数据。
notice.asp文件源码:
<!--#include file="admin_head.asp"-->
<br><br>
<%
dim id,nclass
nclass=cstr(request.QueryString("nclass"))
id=Trim(Request("id"))
Select case Request("method")
Case 1
Call Delnotice()
End Select
const MaxPerPage=10
dim totalPut
dim CurrentPage
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
%>
<table width="95%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolorlight="#ECEEE4" bordercolordark="#CCCABC" class="tableBorder">
<tr>
<th colspan="8" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th height="30" nowrap><div align="left"><input name="butAdd" type="button" value="添加新<%=nclass%>" onClick="javascript:location.href='admin_noticeadd.asp?nclass=<%=nclass%>';"></div></th>
<th width="90%">修改删除<%=nclass%></th>
</tr>
</table>
</th>
</tr>
<tr align="center">
<td width="10%" height="25" class="forumRow">ID</td>
<td width="5%" class="forumRow">操作</td>
<td class="forumRow"><%=nclass%>标题</td>
</tr>
<%
Sql="Select * from news where nclass='&nclass&' order by id desc"
set rs=server.createobject("adodb.recordset")
rs.open Sql,conn,1,1
if rs.eof and rs.bof then
%>
<tr>
<td height="30" colspan="8" align="center" class="forumRow">
<font color=red>还没有添加<%=nclass%>。</font></td>
</tr>
<%
else
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent
PageShow totalput,MaxPerPage,"admin_notice.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
PageShow totalput,MaxPerPage,"admin_notice.asp"
else
currentPage=1
showContent
PageShow totalput,MaxPerPage,"admin_notice.asp"
end if
end if
end if
sub showContent
dim i,crs,cname
i=0
%>
<form action="" name="form1" method="post">
<%do while not rs.eof%>
<tr>
<td height="25" align="center" class="forumRow"><%=rs("id")%></td>
<td height="25" align="center" class="forumRow"><input type="checkbox" name="id" value="<%=rs("id")%>"></td>
<td height="25" align="left" class="forumRow"><a href="admin_noticeedit.asp?id=<%=rs("id")%>"><%=Qcdn.HTMLcode(rs("Title"))%></a>
<%
%></td>
</tr>
<%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
<tr>
<td height="25" colspan="7" class="forumRow">管理操作:全部选择
<input type="checkbox" name="chkall" onClick="javascript:CheckAll(this.form)">
<input onClick="{if(confirm('确定删除选定的<%=nclass%>吗?')){this.document.form1.submit();return true;}return false;}" type=submit value=删除 name=action class="tbutton">
<input type="hidden" name="method" value="1"></td>
</tr>
</form>
<%
end sub
function PageShow(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "<table cellspacing=1 width='100%' border=0 colspan='4' ><form method=Post action="""&filename&"?id="& id &"&clas="&clas&"&clasinfo="&clasinfo&"&action="&action&"¬icekey="¬icekey&"""><tr><td align=right> "
if CurrentPage<2 then
response.write "共<b><font color=red>"&totalnumber&"</font></b>篇&nclass& 首页 上一页 "
else
response.write "共<b><font color=red>"&totalnumber&"</font></b>篇&nclass& <a href="&filename&"?page=1&id="& id &"&clas="&clas&"&clasinfo="&clasinfo&"&action="&action&"¬icekey="¬icekey&">首页</a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&"&id="& id &"&clas="&clas&"&clasinfo="&clasinfo&"&action="&action&"¬icekey="¬icekey&">上一页</a> "
end if
if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&id="& id &"&clas="&clas&"&clasinfo="&clasinfo&"&action="&action&"¬icekey="¬icekey&">"
response.write "下一页</a> <a href="&filename&"?page="&n&"&id="& id &"&clas="&clas&"&clasinfo="&clasinfo&"&action="&action&"¬icekey="¬icekey&">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "
response.write " <b>"&maxperpage&"</b>篇&nclass&/页 "
%>
转到:
<select name='page' size='1' style="font-size: 12px;" onChange='javascript:submit();'>
<%for i = 1 to n%>
<option value='<%=i%>' <%if CurrentPage=cint(i) then%> selected <%end if%>>第<%=i%>页</option>
<%next%>
</select> <%
response.write "</td></tr></FORM></table>"
end function
Sub Delnotice()
if Request("id") = "" then
Errmsg = "<li>请选择您要删除的&nclass&。"
call Qcdn.Err_List(errmsg,1)
Response.end
end if
id = Request("id")
'sql = "update notice set flag = 1 where id in ("& id &")"
sql="Delete from notice where id in ("& id &")"
conn.execute(sql)
Response.Write("<script>alert(""删除成功"");location.href='admin_notice.asp;</script>")
'Response.End()
End Sub
%>
</table>
<!--#include file="admin_copy.asp"-->
Top
3 楼singit3()回复于 2006-03-04 19:07:53 得分 0
你的这句
Sql="Select * from news where nclass='&nclass&' order by id desc"
改成
Sql="Select * from news where nclass='"&nclass&"' order by id desc"
就可以了,应该!Top
4 楼nivzgdo(时代先锋)回复于 2006-03-04 21:04:19 得分 0
问题已经解决,多谢!Top




