我正在寻找一种直接通过SQL查询自定义文件扩展名的flatfiles的方法。
通常使用类似的东西
SELECT * FROM [Text;DATABASE=C:\Flatfiles].[S7121070_ppis#csv]
它与.txt,.csv和.tab一起使用效果非常好。
但是,在我目前的项目中,我使用带有.ftp7扩展名的固定宽度平面文件。 使用VBA查询这些文件时,遇到Err#-2147217911,声明对象或数据库已被锁定。
奇怪的是,只有在我查询不是 .txt,.csv或.tab的任何内容时才会发生这种情况。 意味着无法查询myfile.ftp7 , myfile.ftp , myfile.abc或myfile 。
不能这样做或者我只是遗漏了什么? 谢谢你的帮助! 干杯,马丁
附加信息:
我使用Excel或Access与VBA 将.ftp7重命名为.csv,.txt,.tab解决了这个问题,但是由于只读访问权限而禁止使用 我可以使用schema.ini -files来描述数据结构,所以我希望实际的文件扩展名或多或少是多余的,用于解释文件内容I'm looking for a way to query flatfiles with custom file-extensions directly via SQL.
Normally use something like
SELECT * FROM [Text;DATABASE=C:\Flatfiles].[S7121070_ppis#csv]
which works terrific with .txt, .csv and .tab.
However, in my current project I work with fixed-width flatfiles with an .ftp7-extension. When querying those files in with VBA, I encounter Err# -2147217911, stating that the object or database is locked.
Oddly, this occurs only whenever I querying anything that's not a .txt, .csv or .tab. Meaning myfile.ftp7, myfile.ftp, myfile.abc or myfile can't be queried.
Can't this be done or am I simply missing something? Thanks for your help! Cheers, Martin
Additional Info:
I use either Excel or Access with VBA Renaming .ftp7 to .csv, .txt, .tab solves the problem, but is a no-no due to read-only access I can use a schema.ini-files to describe the data-structure, so i would have expected that the actual file-extension is more or less redundant for interpreting the files contents最满意答案
作为Fionnuala postet: 编辑注册表似乎解决了这个问题。
As postet by Fionnuala: Editing the registry seems to solve the problem.
更多推荐
发布评论