工作表名称不以美元($)符号结尾 [英] Sheet name doesn't end with dollar ($) symbol

查看:161
本文介绍了工作表名称不以美元($)符号结尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:

我暂时搁置了我的问题。

我得到了一些线索,错过了一些值得一提的事情。

很抱歉浪费宝贵的时间。我会很快更新这个问题,如果我成功的话也会发布答案。



感谢所有宝贵的时间。

< hr>

嗯,对于这里的一些人来说这可能是一个非常基本的问题,但我在这个领域没有太多工作,并尝试在互联网上搜索各种关键字组合,但没有得到任何结果与我的问题相关。



问题:在我的一个项目中,我编写了一些代码来读取excel表中的数据行如下所示 -

UPDATE:
I am putting a hold to my question.
I got some clue and missed few things to mention here.
Sorry to waste your valuable time. Will update the question very soon and will post the answer too if I succeed with it.

Thanks all for your valuable time.



Well, this can be very basic question for some people here but I haven't worked much on this area and tried to search in internet with various combinations of keyword but failed to get any result which relevant to my problem.

Problem: In one of my project I have written some code to read data rows from an excel sheet with something like following-

System.Data.OleDb.OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM [" + SheetName + "]", con);



几年来,客户提供的几乎所有excel文件都能正常工作或者其中一个文件失败了获取数据行。它只检索标题行而不是其他数据行。当我将内容复制到一个新的excel文件时,一切正常。



我去调试并发现,对于这个特定的文件,工作表名称只是名称(即 Sheet1 )并且最后不以美元符号( $ )结尾。但是对于其他文件,它带有所需的 $ 符号。



当我更改代码以附加$符号时如果没有'已经,代码工作正常。所有文件都采用相同的格式,即 .xlsx



如果有人请教我这个,如果我在这里遗漏了什么基本的东西?

任何对好文章/文档的引用也会有所帮助。



如有任何问题,请告知我们需要进一步的详细信息。



提前致谢!



我的尝试:



- 调试以找出上述问题


It is working fine for almost all the excel files supplied by the customer since couple of years or so but one of the file is failing to obtain the data rows. It just retrieves the header row and not other data rows. When I copied the content to a new excel file, everything works fine.

I went for debugging and found that, for this particular file the sheet name comes as just the name (i.e. "Sheet1") and doesn't end with a dollar symbol("$") at the end. But for other files, it's coming with the required $ symbol.

When I changed the code to append a $ symbol if there isn't already, the code worked fine. All the files are in the same format i.e, .xlsx

Can someone please educate me on this, if I am missing anything basic here?
Any reference to good article/documentation would also be helpful.

Please let me know in case any further details are required.

Thanks in advance!

What I have tried:

--Debugging to find out the issue as mentioned above

推荐答案

)最后。但是对于其他文件,它带有所需的
") at the end. But for other files, it's coming with the required


符号。



当我更改代码以附加
symbol.

When I changed the code to append a


符号(如果还没有)时,代码工作正常。所有文件都采用相同的格式,即 .xlsx



如果我遗漏任何基本信息,有人可以告诉我这个吗?

任何关于好艺术的提法cle / documentation也很有帮助。



如果需要进一步的详细信息,请告知我们。



提前致谢!



我的尝试:



- 调试以找出上述问题
symbol if there isn't already, the code worked fine. All the files are in the same format i.e, .xlsx

Can someone please educate me on this, if I am missing anything basic here?
Any reference to good article/documentation would also be helpful.

Please let me know in case any further details are required.

Thanks in advance!

What I have tried:

--Debugging to find out the issue as mentioned above


这篇关于工作表名称不以美元($)符号结尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆