得到“姓名的无效括号".当我尝试在Excel工作表上运行查询时出现错误 [英] Getting "Invalid bracketing of name" error when i try to run query on excel sheet

查看:126
本文介绍了得到“姓名的无效括号".当我尝试在Excel工作表上运行查询时出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了做出一些报告,我需要解析一些excel文件.当我尝试从工作表中选择记录时,出现下一个错误:名称'1的无效括号. page $".

In order to make some reports I need to parse some excel files. When I try to select records from sheet I get next error: Invalid bracketing of name '1. page$'.

这里是我的代码:

OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM [1. page$]", connectionString);

例如,如果我将工作表重命名为页面",我知道它将起作用,但是由于我没有命名这些工作表,因此我需要知道如何解决此查询的问题.我该怎么办?

I know it will work if I rename sheet to "page" for example, but as i'm not naming these sheets I need to know how to fix this query to work as it is. What should I do?

推荐答案

我也遇到了同样的问题,将.替换为#,它可以工作.谢谢!

I had this same problem, replaced the . with a # and it works. Thanks!

这篇关于得到“姓名的无效括号".当我尝试在Excel工作表上运行查询时出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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