ASP查询页面中,将查询结果导出到excel,数据库是access,怎么简单怎么做,因为太难的偶看不懂,先谢谢了 30

 我来答
情感家庭小导师
2010-09-21 · TA获得超过449个赞
知道小有建树答主
回答量:807
采纳率:0%
帮助的人:248万
展开全部
我这里有个php的 你修改成asp就可以了
<?php
if($o == "export")
{
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=问卷调查_".$sid."".date("Y-m-d").".xls");
include("../Include/global.php");
if($sid)
{
$Cone.="AND wjdc_xiaoqu_name like '%$sid%' ";
}
$strQuery = "SELECT * "
." FROM wjdiaocha "
."WHERE 1=1 ".$Cone
."order by wjdc_id desc";

$news = mysql_query($strQuery);
echo "姓名"."\t";
echo "性别"."\t";
echo "居住城市或区域"."\t";
echo "联系方式(电话)"."\t";
echo "出生年代"."\t";
echo "职业"."\t";
echo "您的收入"."\t";
echo "您对建业集团的评价是怎样的?"."\t";
echo "建业是河南房地产市场的领导者"."\t";
echo "建业房产质量可以信赖"."\t";
echo "建业的物业服务很好"."\t";
echo "住建业房产是高尚生活与尊贵身份的象征"."\t";
echo "建业是有文化品味、大气厚重的企业"."\t";
echo "建业足球体现了河南精神"."\t";
echo "您是否购买了建业房产(包括住宅与商铺)"."\t";
echo "如果您为购买建业房产,请问您在未来购买方差时会选择建业吗?为什么?"."\t";
echo "您认为建业在产品品质、服务品质上与您所熟悉的其他房地产企业相比,有哪些优势或不足之处?"."\t";
echo "您对于目前所居住或使用的建业房产的规划设计是否满意?"."\t";
echo "整体效果"."\t";
echo "小区景观"."\t";
echo "建筑外观"."\t";
echo "停车场"."\t";
echo "户型设计"."\t";
echo "您对于目前所所居住或使用的建业方差的工程建造品质是否满意?"."\t";
echo "小区内公共设施质量"."\t";
echo "室外景观、照明、地面等公共设施"."\t";
echo "室内墙壁、天花板、门窗、管道、配件等"."\t";
echo "您是否就建业的产品与服务的品质进行过投诉"."\t";
echo "您对于目前所居住或使用的建业的产品与服务的品质是否满意?"."\t";
echo "服务态度"."\t";
echo "物业公司公共环境维护工作的品质"."\t";
echo "面对客户投诉的反应速度"."\t";
echo "客户投诉处理结果"."\t";
echo "您对于目前建业所提供的产品与服务有哪些建议与意见?"."\t";
echo "提交时间"."\t\n";

while($row=mysql_fetch_array($news))
{
if($row['wjdc_mczl']==1)
{
$post = "是";
}
else
{
$post = "否";
}
if($row['wjdc_wyjl_ljnl']==1)
{
$cc = "是";
}
else
{
$cc = "否";
}
echo preg_replace("/\s/","",$row['wjdc_username'])."\t";
echo preg_replace("/\s/","",$row['wjdc_sex'])."\t";
echo preg_replace("/\s/","",$row['wjdc_xiaoqu_name'])."\t";
echo preg_replace("/\s/","",$row['wjdc_phone'])."\t";
echo preg_replace("/\s/","",$row['wjdc_xqgh'])."\t";
echo preg_replace("/\s/","",$row['wjdc_hxsj'])."\t";
echo preg_replace("/\s/","",$row['wjdc_jghj'])."\t";
echo ""."\t";
echo preg_replace("/\s/","",$row['wjdc_shss'])."\t";
echo preg_replace("/\s/","",$row['wjdc_jttc'])."\t";
echo preg_replace("/\s/","",$row['wjdc_fwgh_othermyd'])."\t";
echo preg_replace("/\s/","",$row['wjdc_qtfw_tscl'])."\t";
echo preg_replace("/\s/","",$row['wjdc_fwgh_other'])."\t";
echo preg_replace("/\s/","",$row['wjdc_ztzl'])."\t";
echo preg_replace("/\s/","",$post)."\t";
echo preg_replace("/\s/","",$row['wjdc_gsfwzl_sug'])."\t";
echo preg_replace("/\s/","",$row['wjdc_gszl_sug'])."\t";
if($row['wjdc_mczl']==1)
{
echo ""."\t";
echo preg_replace("/\s/","",$row['wjdc_fszl'])."\t";
echo preg_replace("/\s/","",$row['wjdc_gpszl'])."\t";
echo preg_replace("/\s/","",$row['wjdc_fwzl_other'])."\t";
echo preg_replace("/\s/","",$row['wjdc_fwzl_othwemyd'])."\t";
echo preg_replace("/\s/","",$row['wjdc_ztpj'])."\t";
echo ""."\t";
echo preg_replace("/\s/","",$row['wjdc_wyjl_zrx'])."\t";
echo preg_replace("/\s/","",$row['wjdc_wyjl_csnl'])."\t";
echo preg_replace("/\s/","",$row['wjdc_wyjl_glnl'])."\t";
echo preg_replace("/\s/","",$cc)."\t";
echo ""."\t";
echo preg_replace("/\s/","",$row['wjdc_qtfw_jtdh'])."\t";
echo preg_replace("/\s/","",$row['wjdc_qtfw_jdfw'])."\t";
echo preg_replace("/\s/","",$row['wjdc_qtfw_fwtd'])."\t";
echo preg_replace("/\s/","",$row['wjdc_qtfw_bsxl'])."\t";
echo preg_replace("/\s/","",$row['wjdc_other_sug'])."\t";
}
else
{
echo ""."\t";
echo ""."\t";
echo ""."\t";
echo ""."\t";
echo ""."\t";
echo ""."\t";
echo ""."\t";
echo ""."\t";
echo ""."\t";
echo ""."\t";
echo ""."\t";
echo ""."\t";
echo ""."\t";
echo ""."\t";
echo ""."\t";
echo ""."\t";
echo ""."\t";
}
echo substr(($row['wjdc_addtime']),0,10)." ".substr(("[".$row['wjdc_addtime']." "),11,10)."\t\n";
}
}
?>
比猫画虎 你会吧 最终要的是header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=问卷调查_".$sid."".date("Y-m-d").".xls");这两句
chuan8320
2010-09-21 · 超过27用户采纳过TA的回答
知道答主
回答量:65
采纳率:100%
帮助的人:62.1万
展开全部
<%

Set fs = server.CreateObject("scripting.filesystemobject")

'--假设你想让生成的EXCEL文件做如下的存放
filename = Server.MapPath("/upfiles/online.xls")
'--如果原来的EXCEL文件存在的话删除它
if fs.FileExists(filename) then
fs.DeleteFile(filename)
end if
'--创建EXCEL文件
set myfile = fs.CreateTextFile(filename,true)

Set rs = Server.createobject("Adodb.RecordSet")
m_SQL = "select * from 表 where id is not null order by id desc"

rs.open m_SQL,conn,1,1

if rs.EOF and rs.BOF then
else
dim strLine,responsestr
strLine=""
For each x in rs.fields
strLine = strLine & x.name & chr(9)
Next
'--将表的列名先写入EXCEL
myfile.writeline strLine
Do while Not rs.EOF
strLine=""
for each x in rs.Fields
strLine = strLine & x.value & chr(9)
next
'--将表的数据写入EXCEL
myfile.writeline strLine
rs.MoveNext
loop

rs.Close
set rs = nothing
End If

%>
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式