in

Hydrus Software Forums

Discussions about Hydrus Software Products

SqlException: Incorrect syntax near the keyword 'Key'.

Last post 05-25-2006 3:35 PM by j.monty. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-25-2006 12:20 PM

    • j.monty
    • Top 10 Contributor
    • Joined on 05-08-2006
    • Cols, OH
    • Posts 4

    SqlException: Incorrect syntax near the keyword 'Key'.

    In our current project we have a column in our database named 'key' (yea, i know - naughty naughty). Anyway, the dataset toolkit throws an exception when trying to fill this table. Is there anyway around this? Doing things the old-skool way with the old dataAdapter works fine. In order to use the datasettoolkit does one need to avoid using reserved words or is there a better way to handle this?

    Thoughts?
     
    Here's the SqlException when I  do a multiAdapter.Fill():

    System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'Key'.
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
    ...
    etc.

    later,
    jason
  • 05-25-2006 2:49 PM In reply to

    • John
    • Top 10 Contributor
    • Joined on 05-25-2006
    • Columbus, OH
    • Posts 15

    Re: SqlException: Incorrect syntax near the keyword 'Key'.

    The CommandBuilder class has a property called QuoteAllIdentifiers, which is false by default. Have you tried setting that property to true?
  • 05-25-2006 3:35 PM In reply to

    • j.monty
    • Top 10 Contributor
    • Joined on 05-08-2006
    • Cols, OH
    • Posts 4

    Re: SqlException: Incorrect syntax near the keyword 'Key'.

    Ahhh, yes. Simple enough.

    thanks.

    later,
    jason
Page 1 of 1 (3 items)
Copyright Hydrus Software, 2007. All rights reserved.