CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Web 开发 >  ASP

请教一个关于网页数据传递的问题

楼主nivzgdo(时代先锋)2006-03-04 17:20:08 在 Web 开发 / ASP 提问

数据库表中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&"&noticekey="&noticekey&"""><tr><td   align=right>   "  
      if   CurrentPage<2   then  
   
          response.write   "共<b><font   color=red>"&totalnumber&"</font></b>篇&nclass&&nbsp;首页   上一页&nbsp;"  
      else  
          response.write   "共<b><font   color=red>"&totalnumber&"</font></b>篇&nclass&&nbsp;<a   href="&filename&"?page=1&id="&   id   &"&clas="&clas&"&clasinfo="&clasinfo&"&action="&action&"&noticekey="&noticekey&">首页</a>&nbsp;"  
          response.write   "<a   href="&filename&"?page="&CurrentPage-1&"&id="&   id   &"&clas="&clas&"&clasinfo="&clasinfo&"&action="&action&"&noticekey="&noticekey&">上一页</a>&nbsp;"  
      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&"&noticekey="&noticekey&">"  
          response.write   "下一页</a>   <a   href="&filename&"?page="&n&"&id="&   id   &"&clas="&clas&"&clasinfo="&clasinfo&"&action="&action&"&noticekey="&noticekey&">尾页</a>"  
      end   if  
        response.write   "&nbsp;页次:<strong><font   color=red>"&CurrentPage&"</font>/"&n&"</strong>页   "  
          response.write   "&nbsp;<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

相关问题

  • 网页中的数据传递?
  • 关于数据在网页间的传递
  • 如何把网页中数据传递给applet??
  • 求网页之间传递数据的问题!
  • WebBrowser 怎么向dreamweaver做成的网页传递数据
  • 保存在request中的数据,传递到框架网页中出错
  • 如何将服务器中的数据,传递到网页中的activex里
  • 继续询问网页之间传递数据的问题(请stoneallen再给看看)
  • 网页*数据库
  • 数据传递的问题!?

关键词

  • 数据
  • 新闻
  • asp
  • sql
  • nclass
  • maxperpage
  • totalput
  • currentpage
  • notice
  • 传递

得分解答快速导航

  • 帖主:nivzgdo

相关链接

  • Web开发类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo