访问地址 http://www.qqread.com/mysql/z127110052.html
<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>进入讨论组讨论。

<%@ 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>相关图文阅读
频道图文推荐
健 康 咨 询
时 尚 咨 询
相关专题
- MySQL数据库配置技巧 (87次浏览)
- 深入了解MySQL系统日常管理 (0次浏览)
- 如何保护MySQL重要数据 (0次浏览)
- 浅析MySQL数据库常用管理 (0次浏览)
- 缓存PHP页面代码 可减轻CPU和MYSQL负担 (0次浏览)
- 浅析Tomcat5配置Mysql JDBC数据库连接池 (0次浏览)
- MySQL数据库敏感数据安全保护六大措施 (0次浏览)
- apache+php+mysql+serv_u迷你傻瓜安装程序 (0次浏览)
- Oracle,SQL Server,MySQL的自增变量设置 (0次浏览)
- Win2003下APACHE+PHP5+MYSQL4+PHPMYADMIN的简 (0次浏览)



