主题:  这段代码对吗?为什么

yidixiaoyu

职务:普通成员
等级:1
金币:1.0
发贴:190
#12003/11/11 13:15:09
<%
Set c2=server.createobject("ADODB.Connection")
D2="Driver={Microsoft Excel driver(*.xls)};"
Path2="DBQ="&Server.MapPath("agp.xls")
c2.open D2&path2 '这里是出错的地方
Set r2=Server.createobject("ADODB.Recordset")
r2.open "select*from[Sheet1$]",c2,2,2
%>














<%
for i=0 to r2.fields.Count-1
response.write""
next
%>

<%
r2.movefirst
while not r2.eof
row=""
for i=0 to r2.fields.count-1
row=row&""
next
response.write row
r2.movenext
wend
%>
"&r2(i).name&"
"&r2(i)&"





{ 在指尖上绽放的花朵 }

职务:普通成员
等级:5
金币:14.0
发贴:3209
#22003/11/11 22:01:23
D2="Driver={Microsoft Excel driver(*.xls)}"

汗了……

写在一起试试看?

c2.open "DBQ=" & Server.MapPath("agp.xls") & ";Driver={Microsoft Excel driver(*.xls)}"