回 帖 发 新 帖 刷新版面

主题:[讨论]求助,程序哪里需要修改?

ACCESS转化成SQL2000 后,,留言板数据无法显示,数据库已经确认没问题了,因为整个网站的数据都可以了,现在把留言板的代码帖出来,大家帮我看看是代码哪里需要更改,本来使用access数据库是都正常的,谢谢

部分代码如下:




<%
     
    '''''''''''''''''''''''
    '查看留言
    Sub View_zf11_gb() 
         dim gbcount,y,j,k
         set rs = conn.execute("select COUNT(*) as gbcount From zf11_gb ")
         gbcount=rs("gbcount")
         rs.close
         
         if gbcount/n = int(gbcount/n) then '计算出分页数
         y=int(gbcount/n)
         else
         y=int(gbcount/n)+1
         end if

         page2= int(page/x)
         if page/x>page2 then page2=page2+1
         k=page2*x
         if k>y then k=y

         '打开留言字段'
         if page=1 then
         sql="select top "&n&" id,name,sex,web,email,title,zf11_gb,date,reply,ip,come,view,qq From zf11_gb Order By id Desc"
         else
         sql="select id,name,sex,web,email,title,zf11_gb,date,reply,ip,come,view,qq From zf11_gb Order By id Desc"
         end if
         if Page >100 then
            rs.Open sql,Conn,1
         else
            Set Rs=Conn.Execute(sql)
         end if
         if Page>1 then RS.Move n*page-n
%>
<table width="560" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>      
<td width="100%" height="20" >            </td>
          </tr>
</table>
<% if rs.bof  and rs.eof then Response.Write "当前没有留言记录" %>
<%
    dim lou,zf11_gb,reply,email,qq,web,come
    if Request.QueryString("page")<2 then
    lou=gbcount
    else
    lou=gbcount-((Request.QueryString("page")-1)*n)
    end if 
    i=0
    do while not rs.eof and i<n
    i=i+1
    reply=""
    zf11_gb=""  
    zf11_gb=rs("zf11_gb")
    reply=rs("reply")
%>
<TABLE width="100%" height=10 border=0 align=center cellPadding=0 cellSpacing=1 style="border-collapse:collapse" >

      <TR >
        <TD colSpan=2 height=30><table width="100%" height="30"  border="0" background="images/zf11_gbdaohang.gif" class="unnamed1">
<tr>
<td height="21">&nbsp;&nbsp;主题:<b><%=rs("title")%></b></td>
<td> 

<% if len(trim(rs("web")))>8  then %>
                <a href="<%=rs("web")%>" target="_blank"><img src="<%=imdeximg%>zf11_homepage.gif" alt="<%=rs("web")%>" width=16 height=16 border="0"></a>
<% end if %>
<% if len(trim(rs("email")))>6  then %>
                 <a href="mailto:<%=rs("email")%>"><img src="<%=imdeximg%>zf11_email.gif" alt="<%=rs("email")%>" width="16" height="16" border="0"></a> 
<% end if %>
<% if len(trim(rs("qq")))>3  then %>
                <img src="<%=imdeximg%>zf11_oicq.gif" alt="<%=Rs("qq")%>" width="16" height="16" border="0">
<% end if %>
<% if len(trim(Rs("come")))>1 then %>
                <img src="<%=imdeximg%>zf11_come.gif" alt="来自:<%=Rs("come")%>" width="16" height="16">            </td>
<td width="20%"> 第 <font color="#ff0000"><%=lou %></font> 条留言</td>
          </tr>
        </table>          </TD>
      </TR>
      <TR>
<TD width="111" height="21" align=middle valign="top"> 
<table width="100%" border="0" align="center">
<tr>
<td width="118"align="center">
<%if rs("sex")=1 then %>
  <img src="<%=imdeximg%>zf11_male.gif">
<% else %>
  <img src="<%=imdeximg%>zf11_female.gif">
<% end if %>
<br>
<%=rs("name")%></td>
</tr>
</table></TD>       
<TD width="760" height="21"  style="word-break:break-all"> 
<table width="96%" height="132" border="0" align="center">
<tr>
<td width="100%" height="70" style="line-height: <%=zf11_line_H%>"> 
<br>
<% if webyn=1 and rs("view")=1 then %>
<%=Ubb(unHtml(zf11_gb))%>
<% if len(trim(reply))>1 then%>
<% end if %>  
<hr size="1">
  <span class="style1">管理员回复:</span><br>
  <font color="#990000"> <%=Ubb(unHtml(reply))%> </font>
<%end if %>
<%end if %>
<% if webyn<>1 then %>
<%=Ubb(unHtml(zf11_gb))%>
<% if len(trim(reply))>1 then%>
  <hr size="1">
  <span class="style1">管理员回复:</span><br>
  <font color="#990000"><%=Ubb(unHtml(reply))%> </font>
<%end if %>
<%end if %>
<% if webyn=1 and rs("view")=0 then%>
              管理员正在对您的留言进行审批... 
<%end if %>            </td>
          </tr>
<tr>
  <td height="22" align="right" style="word-break:break-all">发表于:<%=year(Rs("date"))%>年<%=month(Rs("date"))%>月<%=day(Rs("date"))%>日</td>
</tr>
        </table>      </TD>
      </TR>
</TABLE>
<%
    lou=lou-1     
    rs.movenext
    loop
    Rs.Close
    Set Rs = Nothing
%>
<table width="570" border="0" cellspacing="1" cellpadding="4" align="center">
<tr>
    
<td width="100%" height="20" align="center" class="unnamed1"> 有<%=gbcount %>条留言 <%=page %>/<%=y %>页 分页 <a href="?page=1"><<</a>
<% if page2>1 then %>
  <a href="<%=indexfilename%>?page=<%=page2*x-x%>"><</a>
<% end if %>
<% For m =page2*x-(x-1) To k %>
[<a href="<%=indexfilename%>?page=<%=m%>"><%=m%></a>]
<% Next %>
<% if page2*x < y then %>
<a href="<%=indexfilename%>?page=<%=m%>">></a>
<% end if %>
      <a href="?page=<%=y %>">>></a>    </td>
  </tr>
</table>
<% End Sub %>
<br>
<% Sub Edit() %>
<%
    Sql="Select * From zf11_gb Where id="&Request.QueryString("id")
    set rs=conn.execute(sql)
    view2=""
    if rs("view")=1 then
    view2="checked"
    end if
%>
<%
    rs.close
    set rs=nothing
    End Sub
%>

回复列表 (共7个回复)

沙发

http://www.aspprogram.cn/html/article/2008929193911.html
或者这篇文章对你有帮助,你试试

板凳



谢谢楼上,那方法解决了我其他好多地方的问题了
(在仅列出索引,标题什么的时,用conn.execute(). 在要显示完整内容时用rs.open()


不够这边留言板修改了,还是不能显示,麻烦帮看下。修改几个地方如下:


Sub View_zf11_gb() 
         dim gbcount,y,j,k
         set rs=server.createobject("adodb.recordset")
         rs.open "select COUNT(*) as gbcount From zf11_gb ",conn, 1,1
         gbcount=rs("gbcount")
         rs.close
        
        




set rs=server.createobject("adodb.recordset")
         if page=1 then
         sql="select top "&n&" id,name,sex,web,email,title,zf11_gb,date,reply,ip,come,view,qq From zf11_gb Order By id Desc"
         else
         sql="select id,name,sex,web,email,title,zf11_gb,date,reply,ip,come,view,qq From zf11_gb Order By id Desc"
         end if
          if Page >100 then
            rs.Open sql,Conn,1
         else
            rs.Open sql,Conn,1
         end if
         if Page>1 then RS.Move n*page-n
%>

3 楼

rs.Open sql,Conn,1
后面少了一个数字
 rs.Open sql,Conn,1,1
应该这样

4 楼


加1上去也不行,还有其他的原因吗

5 楼

提示什么错误?

6 楼


没有提示任何错误,就是好象无法读取数据库的数据,
之前有很多文章、内容版块  也是这样问题,后面看到你给的那文章方法修改都可以了
就这个留言板还不行。

7 楼

大家帮帮忙啊,,,

我来回复

您尚未登录,请登录后再回复。点此登录或注册