获得Excel中数据时奇怪的问题,急!在线等待!
Excel中的数据如果为:
编号 字段1 字段2
1 3456 gdgdf
2 7667 42423
3 1243 gdgdf
4 gfdgdf treterte
按照下面的代码,第4行第一列的数据就出不来,第二行第2列的数据也出不来,感觉好像Excel会将某列默认为数字或字符似的,请大家帮忙看一下是不是代码有问题,该怎么解决!
strFileName="c:\example.xls"
set rsXsl=Server.Createobject("ADODB.Recordset")
myConn_Xsl="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strFileName & ";Extended Properties=Excel 8.0"
'打开连接
myconnection.open myConn_Xsl
'打开表
str_Xsl="select * from [sheet1$]"
rsXsl.open str_Xsl,myconnection,1,1
Do While not rsXsl.eof
response.write rsxsl(0) & " "
response.write rsxsl(1) & " "
response.write rsxsl(2) & " "
rsXsl.movenext
Loop
另:使用cast定义字段的类型,页面报错,是不是excel不支持cast的用法