Article ID: 165432 - Last Review: October 24, 2003 - Revision: 2.0 PRB: DBGrid Does Not Insert Record If Field Name Contains DashThis article was previously published under Q165432 On This PageSYMPTOMS
When you try to add a row to an SQL Server table using DBGrid bound to a
Remote Data Control, you receive the following error message if one of the
table's field names contains a "-":
ODBC error: 37000 [Microsoft][SQL Server Driver]Line2: Incorrect syntax near '-' CAUSE
This problem occurs because the Remote Data Objects code is creating a SQL
INSERT statement that doesn't put quotation marks around field names. The
INSERT statement would resemble the following:
RESOLUTION
Either rename the field so that it doesn't contain a hyphen or do the
updates manually (where the developer creates the proper SQL syntax).
STATUS
This is by design. SQL Server does not support the use of dashes in its
identifiers, including server names, database names, tables, views,
columns, indexes, triggers, procedures, defaults, and rules.
MORE INFORMATIONSteps to Reproduce Behavior
| Article Translations
|

Back to the top
