用ASP如何实现从数据库中读取数据并导出EXCEL
4个回答
展开全部
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
on error resume next
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "content-disposition", "inline; filename = 楼盘团购报名表"&cstr(date())&".xls"
dim rs,sql, sCount
sql = "SELECT * FROM [LouPan_Buy] ORDER BY ItemName ASC, ID DESC"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
sCount = rs.recordcount
%>
<%
on error resume next
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "content-disposition", "inline; filename = 楼盘团购报名表"&cstr(date())&".xls"
dim rs,sql, sCount
sql = "SELECT * FROM [LouPan_Buy] ORDER BY ItemName ASC, ID DESC"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
sCount = rs.recordcount
%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
可以使用visual studio developer 2005 速成版。
至于代码嘛,找个教程学一下就行
至于代码嘛,找个教程学一下就行
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../inc/conn.asp"-->
<%
on error resume next
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "content-disposition", "inline; filename = 楼盘团购报名表"&cstr(date())&".xls"
dim rs,sql, sCount
sql = "SELECT * FROM [LouPan_Buy] ORDER BY ItemName ASC, ID DESC"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
sCount = rs.recordcount
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>导出团购报名表</title>
</head>
<body>
<h1 align="center">-楼盘团购报名表-</h1>
<h3 align="center">内蒙古房产网 www.nmgfc.cn</h3>
<table width="100%">
<tr>
<td align="left">【报名总人数】:<%=sCount%></td>
<td align="right">【制表时间】:<%=NOW()%></td>
</tr>
</table>
<table width="100%" border="1" cellpadding="0" cellspacing="0">
<tr>
<th width="6%"> 序号</th>
<th width="6%">姓名</th>
<th width="6%">性别</th>
<th width="12%">团购楼盘</th>
<th width="8%">预购价格</th>
<th width="8%">手机</th>
<th width="8%">电话</th>
<th width="12%"> 电子邮件</th>
<th width="9%">QQ号码</th>
<th width="11%">报名时间</th>
<th width="11%">IP地址 </th>
</tr>
<%do while not rs.eof%>
<tr>
<td><%=rs("ID")%></td>
<td><%=rs("Name")%></td>
<td><%=rs("Sex")%></td>
<td><%=rs("ItemName")%></td>
<td><%=rs("Price")%></td>
<td><%=rs("Mobil")%></td>
<td><%=rs("Phone")%></td>
<td><%=rs("Email")%></td>
<td><%=rs("QQ")%></td>
<td><%=rs("Time")%></td>
<td><%=rs("IP")%></td>
</tr>
<%rs.movenext
loop
rs.close
set rs=nothing%>
</table>
</body>
</html>
<!--#include file="../inc/conn.asp"-->
<%
on error resume next
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "content-disposition", "inline; filename = 楼盘团购报名表"&cstr(date())&".xls"
dim rs,sql, sCount
sql = "SELECT * FROM [LouPan_Buy] ORDER BY ItemName ASC, ID DESC"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
sCount = rs.recordcount
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>导出团购报名表</title>
</head>
<body>
<h1 align="center">-楼盘团购报名表-</h1>
<h3 align="center">内蒙古房产网 www.nmgfc.cn</h3>
<table width="100%">
<tr>
<td align="left">【报名总人数】:<%=sCount%></td>
<td align="right">【制表时间】:<%=NOW()%></td>
</tr>
</table>
<table width="100%" border="1" cellpadding="0" cellspacing="0">
<tr>
<th width="6%"> 序号</th>
<th width="6%">姓名</th>
<th width="6%">性别</th>
<th width="12%">团购楼盘</th>
<th width="8%">预购价格</th>
<th width="8%">手机</th>
<th width="8%">电话</th>
<th width="12%"> 电子邮件</th>
<th width="9%">QQ号码</th>
<th width="11%">报名时间</th>
<th width="11%">IP地址 </th>
</tr>
<%do while not rs.eof%>
<tr>
<td><%=rs("ID")%></td>
<td><%=rs("Name")%></td>
<td><%=rs("Sex")%></td>
<td><%=rs("ItemName")%></td>
<td><%=rs("Price")%></td>
<td><%=rs("Mobil")%></td>
<td><%=rs("Phone")%></td>
<td><%=rs("Email")%></td>
<td><%=rs("QQ")%></td>
<td><%=rs("Time")%></td>
<td><%=rs("IP")%></td>
</tr>
<%rs.movenext
loop
rs.close
set rs=nothing%>
</table>
</body>
</html>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
简单的,网上有很多源码
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |