"End" column name bug

Last post 09-11-2006 2:19 PM by phuff. 3 replies.

Sort Posts:

  • "End" column name bug

    09-10-2006, 2:15 AM
    • Loading...
    • cobain81
    • Joined on 06-15-2006, 4:25 AM
    • Posts 19

    I had a table with a column called "End". This situation led up to an error "...incorrect syntax near keyword End".

    Filed under:
  • Re: "End" column name bug

    09-11-2006, 1:56 PM
    • Loading...
    • phuff
    • Joined on 06-11-2002, 8:39 AM
    • Redmond, WA
    • Posts 547
    • AspNetTeam
    Yes, this is another permutation of the issue with VB keywords colliding with table names.  CSharp doesn't have this problem, so you can get around it by using CSharp.  Apologies for the inconvenience.
    Polita Paulus

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: "End" column name bug

    09-11-2006, 2:11 PM
    • Loading...
    • cobain81
    • Joined on 06-15-2006, 4:25 AM
    • Posts 19

    I use CSharp.

    I have two columns, Start and End, datatype:smalldatetime, nullable.

    If i chane column names to something similar (PeriodStart, PeriodEnd) it's all ok.

    This is the error:

    Incorrect syntax near the keyword 'End'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'End'.

    [SqlException (0x80131904): Incorrect syntax near the keyword 'End'.]
       System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +177
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +68
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +199
       System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2411
       System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +147
       System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1038
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +314
       System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +413
       System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +115
       System.Data.DLinq.SqlClient.SqlQuerySession`1.ExecuteNonQuery() +406
       System.Data.DLinq.SqlClient.SqlContext.ExecuteNonQuery(Expression query) +312
       System.Data.DLinq.SimpleChangeDirector.Execute(Expression command, StringBuilder changeText) +64
       System.Data.DLinq.SimpleChangeDirector.ExecuteInsert(TrackedObject item, StringBuilder changeText) +72
       System.Data.DLinq.SimpleChangeDirector.Insert(TrackedObject item) +95
       System.Data.DLinq.ChangeProcessor.SubmitChanges(ConflictMode failureMode) +234
       System.Data.DLinq.DataContext.SubmitChanges(ConflictMode failureMode) +230
       System.Data.DLinq.DataContext.SubmitChanges() +6
       NewSeasonPage.Insert(Season x) +265

    Filed under: ,
  • Re: "End" column name bug

    09-11-2006, 2:19 PM
    • Loading...
    • phuff
    • Joined on 06-11-2002, 8:39 AM
    • Redmond, WA
    • Posts 547
    • AspNetTeam
    This sounds like a different bug with escaping SQL keywords in the commands LINQ generates.  I will report this issue to the LINQ team so they can look at it.  Thanks.
    Polita Paulus

    This posting is provided "AS IS" with no warranties, and confers no rights.
Page 1 of 1 (4 items)
Microsoft Communities
Page view counter