您的位置:程序门 -> 其他数据库开发 -> access



asp中如何将access中的数据导出到本地的excel文件中


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


asp中如何将access中的数据导出到本地的excel文件中[已结贴,结贴人:lilimerci]
发表于:2007-03-13 22:21:05 楼主
asp中如何将access中的数据导出到本地的excel文件中
有实例最好了,谢谢了哈.
发表于:2007-03-13 22:39:471楼 得分:0
--从excel中获取数据
select   *   from   [excel   8.0;database=d:\test.xls].[sheet1$]


--生成excel数据
select   *   into   [excel   8.0;database=d:\test1.xls].sheet1   from   表名
发表于:2007-03-14 07:49:322楼 得分:5
select   *   into   [excel   8.0;database=d:\test1.xls].dd   from   tt
发表于:2007-03-14 21:16:363楼 得分:0
楼上两位兄才,我说的是从access中获取数据并导出为xls文件,并不是从xls文件中导出数据。
请大家多多帮忙哈。
发表于:2007-03-15 09:09:404楼 得分:5
--这就是从access中导出数据,并生成excel数据
select   *   into   [excel   8.0;database=d:\test1.xls].sheet1   from   表名
发表于:2007-03-15 11:51:515楼 得分:0
先谢谢,我去试试
发表于:2007-03-15 12:58:196楼 得分:0
<html>
<head>
<title> test </title>
<meta   http-equiv= "content-type "   content= "text/html;   charset=gb2312 ">
</head>
<body   bgcolor= "#ffffff "   leftmargin= "0 "   topmargin= "0 "   marginheight= "0 "   marginwidth= "0 ">
<tr   align   =   "center ">
    <td   align   =   "center "> this   is   a   test! </td>
</tr>
  <%
dim   strfilepath
dim   strconnectionstring
dim   conn

strfilepath   =   server.mappath( "\test.mdb ")
strconnectionstring   =   "provider=microsoft.jet.oledb.4.0;data   source= "&   strfilepath
set   conn   =   server.createobject( "adodb.connection ")
conn.open   strconnectionstring
%>
<%
dim   n,y,r,s,f,m
n   =   year(now())
y   =   month(now())
r   =   day(now())
s   =   hour(now())
f   =   minute(now())
m   =   second(now())
if   len(n)   =   2   then   n   =   "20 "   &   n
if   len(y)   =   1   then   y   =   "0 "   &   y
if   len(r)   =   1   then   r   =   "0 "   &   r
if   len(s)   =   1   then   s   =   "0 "   &   s
if   len(f)   =   1   then   f   =   "0 "   &   f
if   len(m)   =   1   then   m   =   "0 "   &   m
dim   sql
dim   filename,filename1
filename   =   n   &   y   &   r   &   s   &   f   &   m   &   ".xls "
set   sql   =   conn.EXECute( "select   *   into   [excel   8.0;database=g:\ <%=filename%> ].sheet1   from   jdxx ")
%>
</body>
</html>


出错提示:
microsoft   vbscript   compilation   error   '800a0409 '  

unterminated   string   constant  

\index.asp   ...


set   sql   =   conn.EXECute( "select   *   into   [excel   8.0;database=g:\ <%=filename%> ].sheet1  
这句话里有什么问题么?
我想实现动态获得文件名,如果这样不可以还可以怎么做哈,还请各位帮帮忙啊。
发表于:2007-03-15 13:36:007楼 得分:10
楼主别听楼上的,都是不对的。


asp   操作   access   数据库导出   exce必须经过两个步骤
1、导出数据到服务器端(无论是导出为服务器文件还是服务器变量或者session   都算)
2、让客户端自动下载服务器端的数据。

发表于:2007-03-15 13:37:198楼 得分:0
大版主所言极是。
发表于:2007-03-15 13:56:069楼 得分:0
比较常见的是直接保存到某个变量,两个字段用,号分隔,然后用resposne.write   回写到客户端,文件头里面用   csv   格式,这样   excel   就能自动认的。不过可能存在可是转换上的问题。
发表于:2007-03-15 15:41:0110楼 得分:0
大斑竹   可以举个例子么?
我看了看用resposne.write回写到客户端的,我见过几个例子,不过没测试成功。
还请介绍一两个测试成功的例子哈。
谢谢了。


快速检索

最新资讯
热门点击