1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

ASP导成excel问题

本帖由 小狼2006-08-31 发布。版面名称:后端开发

  1. 小狼

    小狼 New Member

    注册:
    2006-03-15
    帖子:
    163
    赞:
    1
    <%
    Response.AddHeader "Content-Disposition", "attachment;filename=成交客户信息.xls"
    Response.ContentType = "application/ms-word;"
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title> </title>
    </head>
    <% dim obj,cn,cn1,onclickstr,disstr
    Set obj = Server.CreateObject("yxoa.iis")
    set cn = obj.cn_opencn
    set cn1 = obj.cn1_opencn
    dim url,QuerySql
    url=Request.ServerVariables("PATH_INFO")
    '失效:start'
    '失效:end'
    if Request.QueryString("method") = "query" then
    url = url & "?method=query"
    QuerySql=""
    if Request.QueryString("num") <> "" then
    url = url & "&num="&Request.QueryString("num")
    QuerySql = QuerySql & " and num like '%"&Request.QueryString("num")&"%'"
    end if
    if Request.QueryString("client_phone") <> "" then
    url = url & "&client_phone="&Request.QueryString("client_phone")
    QuerySql = QuerySql & " and phone like '%"&Request.QueryString("client_phone")&"%'"
    end if
    if Request.QueryString("require_type") <> "" then
    url = url & "&require_type="&Request.QueryString("require_type")
    QuerySql = QuerySql & " and require_type like '%"&Request.QueryString("require_type")&"%'"
    end if
    if Request.QueryString("code") <> "" then
    url = url & "&code="&Request.QueryString("code")
    QuerySql = QuerySql & " and code like '%"&replace(Trim(request.QueryString("code")),"'","''")&"%'"
    end if
    if Request.QueryString("area") <> "" then
    url = url & "&area="&Request.QueryString("area")
    QuerySql = QuerySql & " and a.area ='"&Request.QueryString("area")&"'"
    end if
    if Request.QueryString("department_id") <> "" then
    url = url & "&department_id="&Request.QueryString("department_id")
    QuerySql = QuerySql & " and b.departmentid ="&Request.QueryString("department_id")&""
    end if
    if Request.QueryString("client_name") <> "" then
    url = url & "&client_name="&Request.QueryString("client_name")
    QuerySql = QuerySql & " and client_name like '%"&replace(Trim(request.QueryString("client_name")),"'","''")&"%'"
    end if
    if Request.QueryString("sdate") <> "" then
    url = url & "&sdate="&Request.QueryString("sdate")
    url = url & "&edate="&Request.QueryString("edate")
    QuerySql = QuerySql & " and tbdate between '"&Request.QueryString("sdate")&" 00:00:00' and '"&Request.QueryString("edate")&" 23:59:59'"
    end if
    end if

    '加入权限start:61_3查看所有,61_2查看本部门,61_5查看本地区
    dim QxQuerySql,sqlflag
    'startend
    '--------------------------
    dim page,strsql,k,rs
    'page=request("page")
    Set RS = Server.CreateObject("Adodb.Recordset")
    if request("require_type")="求租" then
    strsql="select * from Client_info_request_list a left outer join Client_request_rent_detail b on a.clientid=b.mainclientid where b.lookflag=2 "&QuerySql&" "&QxQuerySql&" "&sqlflag&""
    elseif request("require_type")="求购" then
    strsql="select * from Client_info_request_list a left outer join Client_request_sell_detail b on a.clientid=b.mainclientid where b.lookflag=2 "&QuerySql&" "&QxQuerySql&" "&sqlflag&""
    end if
    RS.CursorLocation=3
    'response.Write(strsql)
    RS.open strsql,cn,1,1
    'rs.pagesize=20
    %>
    <table>
    <tr>
    <td><div align="center"><strong>序号</strong></div></td>
    <td><div align="center"><strong>协议号</strong></div></td>
    <td><div align="center"><strong>客户姓名</strong></div></td>
    <td><div align="center"><strong>性别</strong></div></td>
    <td><div align="center"><strong>编号</strong></div></td>
    <td><div align="center"><strong>填表日期</strong></div></td>
    <td><div align="center"><strong>来访目的</strong></div></td>
    <td><div align="center"><strong>录入部门</strong></div></td>
    <td><div align="center"><strong>经办人</strong></div></td>
    <td><div align="center"><strong>客户所在地</strong></div></td>
    <td><div align="center"><strong>客户住址</strong></div></td>
    <td><div align="center"><strong>Email</strong></div></td>
    <td><div align="center"><strong>求租目的</strong></div></td>
    <td><div align="center"><strong>支付方式</strong></div></td>
    <td><div align="center"><strong>坐落位置</strong></div></td>
    <td><div align="center"><strong>面积</strong></div></td>
    <td><div align="center"><strong>价格</strong></div></td>
    <td><div align="center"><strong>设施</strong></div></td>
    <td><div align="center"><strong>所在楼层</strong></div></td>
    <td><div align="center"><strong>房屋结构</strong></div></td>
    <td><div align="center"><strong>朝向</strong></div></td>
    <td><div align="center"><strong>买新房意向</strong></div></td>
    <td><div align="center"><strong>区域</strong></div></td>
    <td><div align="center"><strong>装修</strong></div></td>
    <td><div align="center"><strong>预付金额</strong></div></td>
    <td><div align="center"><strong>委托期限</strong></div></td>
    <td><div align="center"></div></td>
    <td><div align="center"></div></td>
    <td><div align="center"></div></td>
    </tr>
    <%dim str
    if not rs.eof then
    rs.absolutepage = page
    for k=1 to 100000
    obj.set_jlwh session("employee_id"),rs("departmentid")
    onclickstr=obj.onclickstr
    disstr=obj.disstr

    if RS("require_type")="求租" then
    str="house_rent"
    elseif RS("require_type")="求购" then
    str="house_sell"
    elseif RS("require_type")="出租" then
    str="client_rent"
    end if
    %>
    <tr>
    <td><%=k%>.</td>
    <td><%=rs("num")%></td>
    <td><%=replace(RS("client_name")&"","''","'")%></td>
    <td><%=rs("sex")%></td>
    <td><%=rs("num")%>&nbsp;</td>
    <td><%=RS("tbdate")%>&nbsp;</td>
    <td><%=RS("require_type")%></td>
    <td><%=replace(RS("name")&"","''","'")%></td>
    <td><%=RS("jbname")%></td>
    <td><%if RS("clientarea")=1 then response.Write("本地")else response.Write("外地") %></td>
    <td><%=rs("ADDRESS")%></td>
    <td><%=rs("useremail")%></td>
    <td>
    <%if rs("rentaim")="1" then response.write"过渡" end if%>
    <%if rs("rentaim")="2" then response.write"求学" end if%>
    <%if rs("rentaim")="3" then response.write"商住" end if%>
    <%if rs("rentaim")="4" then response.write"拆迁" end if%>
    <%if rs("rentaim")="5" then response.write"长期租房" end if%>
    <%if rs("rentaim")="6" then response.write"其他" end if%></td>
    <td>
    <%if rs("paytype")="1" then response.write"一次性" end if%>
    <%if rs("paytype")="2" then response.write"一次性或按揭" end if%>
    <%if rs("paytype")="3" then response.write"银行按揭" end if%> </td>
    <td><%=rs("address")%></td>
    <td><%=rs("acreage")%></td>
    <td><%=rs("price")%> <%if rs("require_type")="求购" then response.Write("万元") else response.Write("元/月") end if%></td>
    <td><%=rs("Equipment")%></td>
    <td><%=rs("floor_layer")%></td>
    <td><%=rs("housetype")%></td>
    <td><%=rs("toward")%></td>
    <td> <%if rs("Newbuy") =0 then
    response.Write("无")
    else
    response.Write("有")
    end if
    %> </td>
    <td><%=rs("buyregion")%></td>
    <td><%=rs("fitment")%></td>
    <td><%=rs("zjf")%></td>
    <td><%=rs("bdate")&"至"&rs("edate")%></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    <%
    rs.MoveNext()
    if rs.EOF then
    exit for
    end if
    next%>
    <%'----分页----
    response.write"<tr><td colspan='8'>"
    'SetPage url, rs.pagesize,page,rs.pagecount
    response.write"</td></tr>"
    %>
    <%
    else
    response.write"<tr><td colspan='8' align='center' height='60'>"
    response.write"记录为空!"
    response.write"</td></tr>"
    %>
    <%
    end if
    rs.close
    set rs=nothing
    cn.close
    set cn=nothing
    %>
    </table>
    </body>
    </html>

    我想把这页的数据导成excel,但是效果是只闪了一下,然后没有动静了
    大家帮我看看问题出在哪~~
     
    已获得 平行线 的点赞。