Problem with Insert query to Paradox table using C#

醉酒当歌 提交于 2019-12-05 05:40:56

You need to use the quoted identifiers while having special character in field or table names. The double-quote (") should be what you're looking for.

Besides, I do believe that the Borland Database Engine is required in order to work against a Borland database such as Paradox. At least, that what I have always been told to, though I have never yet experienced such architecture, since I was using Delphi when working with Paradox.

As you founda (somewhat convoluted) solution... Might be worth putting an ODBC trace on and seeing how Access is passing the field name that's causing the issue. It may just be an escape sequence that paradox accepts for the hash (#) or something similar. Just a thought.

I was able to reproduce the problem by creating a table (Table1) with a column that has number sign (col#). Like:

INSERT INTO `Table1.db` (`col#`) VALUES ('a')

Where I run this SQL I get this Error:

The INSERT INTO statement contains the following unknown field name: 'col#'.  Make sure you have typed the name correctly, and try the operation again.

This seems to be a bug Microsoft JET provider. The only workaround is found is to insert the value into another column like

INSERT INTO `Table1.db` (`col1`) VALUES ('a')

And then update the col# column:

UPDATE `Table1.db` SET `col#` = col1

I found other problems with the JET provider. For example, you will get this wrong error if the table is does not have a primary key or password protected:

Operation must use an updateable query.
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!