导出的问题
<%
set conn=server.createobject("adodb.connection")
conn.open"driver={microsoft access driver (*.mdb)};dbq="&server.mappath("../mydata/yzsm!@#$%.asa")
set rs1=server.CreateObject("adodb.recordset")
rs1.open "select id,date from xueyuan",conn,1,3
%>
<script language=javascript>
var oXL = new ActiveXObject("Excel.Application");
var oWB = oXL.Workbooks.Add();
var oSheet = oWb.ActiveSheet;
oSheet.Cells(1,1).value="数据库导出的列表"
oSheet.Cells(2,1)="id"
oSheet.Cells(2,2)="date"
<%
iii=3
while not rs1.eof do
oSheet.Cells(iii,1)=rs1(0) 行18oSheet.Cells(iii,2)=rs1(1)
iii=iii+1
Rs1.movenext
loop
wend
%>
oXL.Visible = true;
oXL.UserControl = true;
</script>
错误提示:
<font face="宋体" size=2>
<p>Microsoft VBScript 运行时错误</font> <font face="宋体" size=2>错误 '800a01a8'</font>
<p>
<font face="宋体" size=2>缺少对象: 'rs1(...)'</font>
<p>
<font face="宋体" size=2>/xiaowu/daochu.asp</font><font face="宋体" size=2>,行 18</font>
------解决方案--------------------为什么要双重循环?
VBScript code
do while not rs1.eof
oSheet.Cells(iii,1)=rs1(0)
oSheet.Cells(iii,2)=rs1(1)
iii=iii+1
rs1.movenext
loop
------解决方案--------------------