| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 425 人关注过本帖
标题:asp可以连接access,在单元格不能显示出数据库对应的记录
只看楼主 加入收藏
zys_qd
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2011-3-30
结帖率:0
收藏
已结贴  问题点数:20 回复次数:3 
asp可以连接access,在单元格不能显示出数据库对应的记录
<table width="100%" height="122"  border="0" align="left" cellpadding="0" cellspacing="0">
                  <%
                        
                        
            set Rs=server.CreateObject("adodb.recordset")
            
            sqlStr="select * from Product where BigClassName='项目' and Passed=True order by  ID desc"
   
            Rs.open sqlStr,conn,1,1
            Rs.pagesize=7                              
            page =clng(Request.QueryString("page"))
            if page<1 then page=1
            if page>Rs.pagecount then page=Rs.pagecount
                                          
            if not Rs.eof then   
            rs.AbsolutePage = page   
                                                
                    %>
                  <tr>
                    <%
        s = 0
        for i = 1 to rs.pagesize
            if s = 0 then
                response.write "<tr>"
            end if
            if rs.eof then exit for
        %>
                    <td  align="left" height="150" style="border-bottom:#B3DCE8 1px solid"><table width="100%" height="116" border="0" cellpadding="0" cellspacing="0" >
                        <tr>
                          <td width="213" rowspan="2" align="center" valign="middle"><a href="ProductShow.asp?id=<%=Rs("id")%>"  target="_blank"><img src="<%if Rs("DefaultPicUrl")<>"" then response.write Rs("DefaultPicUrl") else response.write "pic/nopic2.gif" end if%>" width="202" height="138" border="0" style="FILTER: alpha(opacity=100)" onmouseover="nereidFade(this,80,10,5)" onmouseout="nereidFade(this,100,10,5)" /></a></td>
                          <td width="438" height="30" align="left" valign="middle" style=" padding-left:10px;border-bottom:1px #B6DCEB solid; border-left:1px #B6DCEB solid;"><%=cutstr(rs("title"),400)%></td>
                        </tr>
                        <tr>
                          <td height="108" align="left" valign="top" style="padding-left:10px;border-left:1px #B6DCEB solid;"><%=cutstr(rs("Content"),400)%></td>
                        </tr>
                    </table></td>
                    <%
        if s =0 then
            response.Write"<tr>"
            s = -1
            end if
            rs.movenext
            s = s+ 1
        next   
        %>
                    <%                  
            else
                response.Write("<tr><td>还没有添加信息。</td></tr>")
            end if            
            %>
                  </tr>
                </table></td>
              </tr>
              <tr>
                <td height="40" align="right" style="font-size:12px;"><%
            if Rs.RecordCount<>0 then
                if rs.pagecount=1 then
                    response.Write "上一页&nbsp;&nbsp;"
                    response.Write "下一页&nbsp;&nbsp;"
                else
                    if page=1 then
                        response.Write "上一页&nbsp;&nbsp;"
                        response.Write "<a href=?page="& (page+1) &">下一页</a>&nbsp;&nbsp;"
                    elseif page=Rs.pagecount then
                        response.Write "<a href=?page=" & (page-1) &">上一页</a>&nbsp;&nbsp;"
                        response.Write "下一页&nbsp;&nbsp;"
                    else
                        response.Write "<a href=?page=" & (page-1) &">上一页/a>&nbsp;&nbsp;"
                        response.Write "<a href=?page="& (page+1) &">下一页</a>&nbsp;&nbsp;"
                    end if
                end if
            end if
            %>
                  &nbsp;&nbsp;当前页<%=page%>/<%=rs.pagecount%>,&nbsp;共<%=rs.RecordCount%>条信息 &nbsp;9条每页
                  <%Rs.close%>                </td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td><img src="images/ny_17.jpg" width="730" height="30" /></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
      </tr>
</table>
搜索更多相关主题的帖子: access 数据库 
2011-03-30 11:58
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:10 
是显示“还没有添加信息”,还是空白表格,或者是错误提示?

----我怎能在别人的苦难面前转过脸去----
2011-03-30 13:57
hams
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:18
帖 子:912
专家分:3670
注 册:2008-7-30
收藏
得分:10 
            if s =0 then
             response.Write"<tr>"
             s = -1
            end if
            rs.movenext
            s = s+ 1
知道这会是什么结果么?自己算一下。

俺不高手,俺也是来学习的。
俺的意见不一定就对,当你不认同时请点忽视按钮。
当走到十字路口不知该如何走时,可在论坛问下路,但你若希望别人能一路把你送到目的地,显然是不现实的,因为别人也有自己要走的路。
2011-03-30 14:35
zys_qd
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2011-3-30
收藏
得分:0 
谢谢,问题解决了。是xp 下iis 有问题,换个asp服务器就正常显示了
2011-04-03 11:21
快速回复:asp可以连接access,在单元格不能显示出数据库对应的记录
数据加载中...
 
   



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

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