上一篇:vbscript与javascript传递变量 >>
WSH 直接将查询数据结果生成EXCEL表
改成asp文件放在服务器上面向客户
option explicit
dim conn,strconnstring
set conn = wscript.createobject("adodb.connection")
on error resume next
strconnstring ="provider=sqloledb.1;password=up;" & _
"persist security info=true;user id=ui;" & _
"initial catalog=ucool;" & _
"data source=111.111.111.111;connect timeout=15"
conn.open strconnstring
if err.number <> 0 then
wscript.echo "数据库链接不畅!;"
wscript.quit
end if
on error goto 0
dim rs,sql
set rs=wscript.createobject("adodb.recordset")
on error resume next
sql="select name,dw,dwdz,zw,sex,email from t1 order by id desc"
rs.open sql, conn
if err.number <> 0 then
wscript.echo "查询语句有误!;"
wscript.quit
end if
on error goto 0
dim rsname,i
on error resume next
rsname=rs( 0 ).name
for i = 1 to rs.fields.count - 1
rsname=rsname&chr(9)&rs( i ).name
next
rsname=rsname&chr(13)
dim strdate
strdate=rsname&rs.getstring(2,-1,,," ")
if err.number <> 0 then
wscript.echo "保存数据时出错!;"
wscript.quit
end if
set conn=nothing
set rs=nothing
on error goto 0
dim fs,fl,path,ntime
set fs=wscript.createobject("scripting.filesystemobject")
path=wscript.scriptfullname
path=left(path,instrrev(path,"\"))
ntime=cstr(now)
ntime=replace(ntime,":","_")
on error resume next
set fl=fs.createtextfile(path&ntime&".xls",true)
fl.write strdate
if err.number <> 0 then
wscript.echo "建立文件出错!;"
end if
()
下一篇:树型结构在ASP中的简单解决 >>
相关文章:
- · 用Js判断输入的时间是否有效
- · 游标广告
- · 离开时显示停留时间
- · 树型目录菜单
- · 自动展开的窗口
- · 文字在状态栏逐字放入
- · 文字从状态栏右冒出
- · 文字从状态栏左冒出
- · 自动刷新页面
- · 格式化数字函数FormatNumber
- · 检测浏览器类型并用声音提示
- · 使窗口只第一次访问时弹出
- · 单一表单的多个递交方案
- · 日历
- · 让图按顺序显示
- · 判断输入框不为空
- · 常用email校验函数
- · 有效地控制表单元素的选择方式
- · Iframe的隐藏和显示
- · 删除字符串中间的空格
- · 动态的下拉菜单
- · Trim在Javascript中的实现方法
- · 检测浏览器是否安装了视频插件
- · 随机显示背景
- · 从Select选择中新开一个窗口
- · 让焦点自动跳转
- · 检查电话号码的正确性
- · 通过超链接提交表单
- · Exchange2000系统建设及规划
- · 旅游网站应用设计
- · 股票网站方案设计
- · 银行网站应用方案
- · 商业网站应用设计
- · 医院管理系统(HIS)应用设计
- · 学校教学网站应用设计
- · 教委办公系统解决方案
- · BBSXP多个文件存在Sql Injection漏洞
- · 批量处理JDBC语句提高处理速度
