TMSQuery fails update when columnname contains period

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
smukkel
Posts: 3
Joined: Wed 26 Nov 2008 11:59
Location: Rotterdam, Netherlands

TMSQuery fails update when columnname contains period

Post by smukkel » Wed 26 Nov 2008 12:47

When a TMSQuery is used as dataset, a dataset.Post fails for a dataset that is in edit mode, IF the select query (in sql) refers to a table containing a column with a period in its name. At the same time, dataset.Post succeeds when dataset is in insert mode.

The exception that occurs:

Incorrect syntax near '='.

Notes
- The exception occurs even if the sql contains no '=' (no where clause in the select * from tablename)
- The exception does NOT occur if everywhere (both in table-column definition) the '.' is replaced by e.g. '_'.
- A different exception (
Incorrect syntax near 'AS'
) may occur for a slightly more complex query, refering to columns containing multiple '.'

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 26 Nov 2008 15:24

To solve this problem you should set the TMSQuery.Options.QuoteNames property to True.
Also check that you use the latest SDAC build.

smukkel
Posts: 3
Joined: Wed 26 Nov 2008 11:59
Location: Rotterdam, Netherlands

Post by smukkel » Wed 26 Nov 2008 16:09

Thanx dimon. :D

Setting QuotedNames to True seems to do the trick.
I upgraded to the most recent sdac version (4.70.0.42), before starting to complain on this forum. This seemed wise, esp. because i recall a release note about problems with spaces in names.

Leo

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Thu 27 Nov 2008 06:52

It is good to see that this problem has been solved. If any other questions come up, please contact me.

Post Reply