本文介绍了将数据从Excel指定到VB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好到目前为止我已经按照您的代码示例使用MSAC(xls / xlsx)使用MDAC和Oledb。



我正试图从Excel 2010中的工作表中获取特定单元格中的数据,但它似乎给了我一些问题。这是我下面的代码



MyCommand =新OleDb.OleDbDataAdapter(_

select * from [&SheetList(6),& $ B4,MyConnection)



我知道必须有一个简单的修复,可能是一个不合适的支架。我非常感谢你能给我的任何帮助。谢谢:)

解决方案




来源: []



其次,替换:



with:

 MyCommand =  OleDb.OleDbCommand 


Hello so far I followed your code example for Working with MS Excel(xls / xlsx) Using MDAC and Oledb.

I''m trying to get data from a specific cell from my worksheet in Excel 2010 however it seems to be giving me some issues. Here is my code below

MyCommand = New OleDb.OleDbDataAdapter( _
"select * from [" & SheetList(6), & "$B4", MyConnection)

I know there has to be a simple fix, maybe a bracket out of place or something. I greatly appreciate any help you may be able to give me. Thanks :)

解决方案




Source: Accessing Microsoft Office Data from .NET Applications[^]

Secondly, replace:

with:

MyCommand = New OleDb.OleDbCommand


这篇关于将数据从Excel指定到VB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 16:47