locked
Need help! System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'Read RRS feed

  • Question

  • Sorry I'm not really sure where to put this but I'm having a problem with my ASP.NET page..the entire message is copy/pasted below:

    Server Error in '/WebSite18' Application.

    Incorrect syntax near the keyword 'Read'.

     

     

    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 'Read'.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [SqlException (0x80131904): Incorrect syntax near the keyword 'Read'.]
      System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1950890
      System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846875
      System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
      System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
      System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +204
      System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954
      System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
      System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +175
      System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +137
      System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +386
      System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +325
      System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +92
      System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +907
      System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +704
      System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +95
      System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
      System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +123
      System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
      System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +118
      System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +166
      System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
      System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
      System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
      System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082

    • Moved by Barclay Hill Thursday, April 29, 2010 10:32 PM More appropriate forum (From:Visual Studio Database Development Tools (Formerly "Database Edition Forum"))
    Thursday, April 29, 2010 9:42 PM

Answers

  • READ is a reserved keyword. If you use it as a column or table name, you would receieve that error. To resolve it, you need to put all the names that use reserved words into square brackets, like

    SELECT [DATE], [MYOTHERCOLUMNNAME] FROM [READ]

    If this is not the case, you would need to post your SQL statement here, otherwise it's just a guess


    Val Mazur (MVP) http://www.xporttools.net
    Friday, April 30, 2010 10:29 AM