获得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的用法
编号 字段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的用法
...全文
相关推荐
电脑可能问题大全 wd.docx
电脑可能问题大全
如何给Excel加速【会计实务操作教程】.pptx
如何给Excel加速【会计实务操作教程】.pptx
excel表格里的图片如何保存.doc
excel表格里的图片如何保存.doc
Excel VBA 代码清理器
在创建 VBA 程序的过程中,您的文件中会生成大量垃圾代码。如果您不定期清理您的文件,您将遇到由这些额外垃圾代码引起的奇怪问题。清理项目涉及将其所有 VBComponents 的内容导出到文本文件、删除组件,然后从文本文件中重新导入组件。
如何在excel中实现工作日的计算【会计实务操作教程】.pptx
如何在excel中实现工作日的计算【会计实务操作教程】.pptx


