简体   繁体   English

Excel单元格到ADODB.Recordset

[英]Excel Cells to ADODB.Recordset

I have an Excel spreadsheet that I want to make into an ADODB.Recordset . 我有一个要制作成ADODB.Recordset的Excel电子表格。 I've done this with an Excel table before, but not just cells. 我之前使用Excel表完成过此操作,但不仅限于单元格。 The Fields are in row 4 while the Values are in row 5. Everything before and after that is just visual garbage such as Title etc. Fields位于第4行,而Values位于第5行。在此之前和之后的所有内容都只是视觉垃圾,例如Title等。

Normally I would just do something like getSomething = MyADO.executeQuery("SELECT * FROM [Worksheet$]") , but I'm lost on what to do here and how to test that it works. 通常,我只会做类似getSomething = MyADO.executeQuery("SELECT * FROM [Worksheet$]") ,但是我迷失了在此处执行的操作以及如何对其进行测试的方法。

consider using EEPlus to manipulate the excel object model. 考虑使用EEPlus来操纵excel对象模型。

http://epplus.codeplex.com/ http://epplus.codeplex.com/

这对我有用(在Excel VBA中用ADO测试...)

getSomething = MyADO.executeQuery("SELECT * FROM [Worksheet$4:5]")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM