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
查看全文
相关阅读:
TinyEditor:简洁且易用的html所见即所得编辑器
arguments.callee 调用自身
java.io.IOException: 设备未就绪
关于vcastr3播放器自动播放的问题
javascript中IE浏览器不支持NEW DATE()带参数的解决方法
Oracle常用查看表结构命令
java通过文件头内容判断文件类型
RS开发日期提示控件默认为昨天
Cognos更新问题之利用Transform实现Cube增量更新
SqlServer中从字符串中获取项目指标方法charindex月substring结合
原文地址:https://www.cnblogs.com/Dicky/p/389427.html
最新文章
python打包_cx_freeze
[原]LVM管理与虚拟机管理
关于圈复杂度CCN NCSS
Hudson & Jenkins
一款C++工具
Stopping System V runlevel compatibility fail解决
一个mount问题解决办法,关于partprobe命令
Js 创建等待画面并不难
执行Render()方法时出现 "只能在执行 Render() 的过程中调用 RegisterForEventValidation;"错误
asp.net 将GridView导出到Excel
热门文章
Asp.Net中几种相似的标记符号: < %=...%> < %#... %> < % %> < %@ %>解释及用法(转)
Asp.net 后台调用js方法(转)
C# 使用事务
js文件引用另外一个js文件方法(转)
Keycode对照表
Reporting serverce 中格式化日期
js操作frameset 中 frame 对象(转)
java web 三层架构
two or more web modules defined in the configuration have the same context root
java 过滤器(参数传递中文乱码)
Copyright © 2011-2022 走看看