zoukankan
html css js c++ java
导出SQLServer数据到Excel中
<
%@ Language
=
VBScript%
>
<
html
>
<
head
>
<
meta http
-
equiv
=
"
Content-Type
"
content
=
"
text/html; charset=gb2312
"
>
<
title
>
导出SQLServer数据到Excel中
</
title
>
</
head
>
<
body
>
<
%
Response.Clear
Response.ContentType
=
"
text/xls
"
Response.AddHeader
"
content-disposition
"
,
"
attachment;filename=Excel.xls
"
'
生成Excel
Response.Write
"
编号
"
&
Chr
(
9
)
&
"
姓名
"
&
Chr
(
9
)
&
"
性别
"
&
Chr
(
9
)
&
"
年龄
"
&
Chr
(
13
)
Set
Conn
=
Server.CreateObject(
"
Adodb.Connection
"
)
ConnStr
=
"
Provider=SQLOLEDB.1;Persist Security Info=True;User ID=sa;Password=;Initial Catalog=Info;Data Source=127.0.0.1
"
Conn.Open ConnStr
Sql
=
"
SELECT * FROM INFO
"
Set
Rs
=
Conn.Execute(Sql)
Num
=
Rs.Fields.Count
Do
While
Not
Rs.Eof
MM
=
0
While
MM
<
CInt
(Num)
Data
=
Data
&
Rs(MM)
&
Chr
(
9
)
MM
=
MM
+
1
Wend
Response.Write Data
&
Chr
(
13
)
Data
=
""
Rs.MoveNext:
Loop
Set
Rs
=
Nothing
Conn.Close
Set
Conn
=
Nothing
Response.Flush
Response.End
%
>
</
body
>
</
html
>
青苹果Web应用商店
https://webapp.taobao.com/
PHP/ASP.NET/ASP/UCHOME/DISCUZ! X系列网站开发,详细需求联系
QQ:8511978
查看全文
相关阅读:
Spring MVC程序中得到静态资源文件css,js,图片文件的路径问题总结
【转】MySQL数据丢失讨论
【摘】 pt-query-digest工具一解
【摘】Mysql备份还原数据库之mysqldump实例及参数详细说明
【原】redis插件安装
【摘】linux中fstab解说
【原】mysql慢日志分析
【原】带宽、流量单位换算关系
【转】Linux查看内存大小和插槽
【转】bind
原文地址:https://www.cnblogs.com/Dicky/p/389427.html
最新文章
前端开发之弹出框系列教程五:Loading提示框
慕课网SEO讲解
滚动字幕marquee
myfocus,焦点图
winform知识点
窗体单例
this.tag
js插件
字符集
小知识点
热门文章
IE兼容性
git push error fatal: The remote end hung up unexpectedly
Spring MVC Restful Method PUT @RequestParam NOT FOUND
Java 读本地文件
ibatis配置log4j输出sql语句等日志信息
切换JDK以后 Eclipse无法打开
PlayFramework
Openfire上传插件不生效
Windows下切换JDK版本
Android Missing styles Error
Copyright © 2011-2022 走看看