`
yuanjinxiu
  • 浏览: 660447 次
文章分类
社区版块
存档分类
最新评论

数据库资料生成excel

 
阅读更多


<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%><%

'//数据库链接set conn=server.CreateObject("adodb.connection")DBPath = Server.MapPath("excel.mdb")conn.open "provider=microsoft.jet.oledb.4.0; data source="&DBpath%><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>无标题文档</title><style type="text/css"><!--body,td,th {font-size: 12px;}--></style></head>

<body><%response.ContentType="application/vnd.ms-excel"%><%set rs=conn.execute("select * from guestbook")%><table border="1" cellspacing="0"> <tr> <% j=2 for i=0 to rs.fields.count-1 %> <td width="50" align="center" bgcolor="#FFFFCC"><%=rs.fields(i).name%></td> <%next%>

</tr> <%do while not rs.eof%> <tr> <%for i=0 to rs.fields.count-1%> <td align="center" ><%=rs(i)%></td><%next%>

</tr> <% rs.movenext j=j+1 loop rs.close %></table></body></html>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics