标题:ASP+ACCESS导出到EXCEL无显示数据,请帮忙
取消只看楼主
Angellina
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2008-3-24
 问题点数:0 回复次数:2 
ASP+ACCESS导出到EXCEL无显示数据,请帮忙
我页面的主要代码如下,页面正常显示数据集,可导出到EXCEL时只有表头表尾<TABLE>不显示


<!--#include file="../../Connections/connRoot.asp" -->
<%
Dim Rec1__MMColParam
Rec1__MMColParam = "1"
If (Request.QueryString("activityID") <> "") Then
  Rec1__MMColParam = Request.QueryString("activityID")
End If
%>
<%
Dim Rs_enr
Dim Rs_enr_numRows

Set Rs_enr = Server.CreateObject("ADODB.Recordset")
Rs_enr.ActiveConnection = MM_conn_STRING

Rs_enr.Source="select   activity.activityID,activity.activityName,enrollmentID,member.userID,userName,userpartDepartment,enrollmentTime,userTelephone,enrollmentMemo,isparticipate from activity,enrollment,member where activity.activityID=enrollment.activityID and enrollment.userID=member.userID and activity.activityID='" + Replace(Rec1__MMColParam, "'", "''") + "' ORDER BY enrollment.enrollmentTime DESC"

Rs_enr.CursorType = 0
Rs_enr.CursorLocation = 2
Rs_enr.LockType = 1
Rs_enr.Open()
Rs_enr_numRows = 0
%>

……  ……
<body>
<div align="center">
<br>
  <table width="98%" border="0" cellpadding="5" cellspacing="1" bgcolor="#999999">
    <tr>
      <td align="center" height="23" bgcolor="#0377BC"><span class="STYLE1"><font color="#FFFFFF">活动详细记录</font></span></td>
    </tr>
    <tr>
      <td align="center" bgcolor="#FFFFFF"><br>

      <form name="form1" method="post" >
        <%if request("post")<>"" then      
        Response.Buffer = True  
        Response.ContentType = "application/vnd.ms-excel"
        Response.AddHeader "attachment; fileName=报名记录单.xls"
       end if%>

<table width="98%" border="0" cellpadding="5" cellspacing="1" bgcolor="#999999" id="table1" style="border-collapse: collapse">

…… ……
 </table>

<%if request("post")<>"" then response.End() end if%>        
      <div align="center"><br>
   <input type="submit" name="Submit" value="导出到Excel"  onClick="window.open('activity_enrollMg.asp?post=true')">        
       </div>
 
    </form>
      
    <br /></td></tr>
  </table>
</div>
</body>

说明:类似的代码我在SQL数据库用过,不知道是不是因为ACCESS数据库的限制还是这代码里的其他问题,请指教,感激不尽!
搜索更多相关主题的帖子: EXCEL ACCESS ASP 数据 
2008-03-24 23:40
Angellina
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2008-3-24
得分:0 
到底是怎么回事啊~~?
2008-03-25 22:24
Angellina
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2008-3-24
得分:0 
????
2008-03-26 21:29



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-205160-1-1.html




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

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