'ProductId' 附近有语法错误。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.SqlClient.SqlException: 'ProductId' 附近有语法错误。源错误: 执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。  堆栈跟踪: 
[SqlException (0x80131904): 'ProductId' 附近有语法错误。]
   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.SqlDataReader.ConsumeMetaData() +33
   System.Data.SqlClient.SqlDataReader.get_MetaData() +83
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
   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.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
   System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141
   System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
   System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) +10
   Microsoft.Practices.EnterpriseLibrary.Data.Database.DoExecuteReader(DbCommand command, CommandBehavior cmdBehavior) +181
   Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteReader(DbCommand command) +130
   Hidistro.SaleSystem.DistributionData.ProductData.GetCounDownProducList(Int32 maxnum) in F:\edit\hidistro20\Hidistro.SaleSystem.DistributionData\ProductData.cs:108
   Hidistro.SaleSystem.Catalog.ProductBrowser.GetCounDownProducList(Int32 maxnum) in F:\edit\hidistro20\Hidistro.SaleSystem.Catalog\ProductBrowser.cs:34
   Hidistro.UI.SaleSystem.Tags.Common_GoodsList_LatestCountDownBuy.AttachChildControls() in F:\edit\hidistro20\Hidistro.UI.SaleSystem.Tags\Common_GoodsList_LatestCountDownBuy.cs:16
   Hidistro.UI.Common.Controls.AscxTemplatedWebControl.CreateChildControls() in F:\edit\hidistro20\Hidistro.UI.Common.Controls\AscxTemplatedWebControl.cs:24
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +44
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842 
--------------------------------------------------------------------------------

解决方案 »

  1.   

    不帖出SQL语句,神也回答不了你
      

  2.   

    代码都没有,这是要我们目测么?我目测是你的SQL语句不对,标点符号之类的仔细看看
      

  3.   

    神一般的问题,需要神一般的想象,做出神一样的回答。孩子,请贴出sql语句
      

  4.   

    找你的sql
    告诉你了,错误就在 'ProductId' 附近。
      

  5.   

    [SqlException (0x80131904): 'ProductId' 附近有语法错误。]
        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.SqlDataReader.ConsumeMetaData() +33
        System.Data.SqlClient.SqlDataReader.get_MetaData() +83
        System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
        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.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
        System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141
        System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
        System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) +10
        Microsoft.Practices.EnterpriseLibrary.Data.Database.DoExecuteReader(DbCommand command, CommandBehavior cmdBehavior) +181
        Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteReader(DbCommand command) +130
        Hidistro.SaleSystem.DistributionData.ProductData.GetCounDownProducList(Int32 maxnum) in F:\edit\hidistro20\Hidistro.SaleSystem.DistributionData\ProductData.cs:108
        Hidistro.SaleSystem.Catalog.ProductBrowser.GetCounDownProducList(Int32 maxnum) in F:\edit\hidistro20\Hidistro.SaleSystem.Catalog\ProductBrowser.cs:34
        Hidistro.UI.SaleSystem.Tags.Common_GoodsList_LatestCountDownBuy.AttachChildControls() in F:\edit\hidistro20\Hidistro.UI.SaleSystem.Tags\Common_GoodsList_LatestCountDownBuy.cs:16
        Hidistro.UI.Common.Controls.AscxTemplatedWebControl.CreateChildControls() in F:\edit\hidistro20\Hidistro.UI.Common.Controls\AscxTemplatedWebControl.cs:24
        System.Web.UI.Control.EnsureChildControls() +87
        System.Web.UI.Control.PreRenderRecursiveInternal() +44
        System.Web.UI.Control.PreRenderRecursiveInternal() +171
        System.Web.UI.Control.PreRenderRecursiveInternal() +171
        System.Web.UI.Control.PreRenderRecursiveInternal() +171
        System.Web.UI.Control.PreRenderRecursiveInternal() +171
        System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
     
      

  6.   

    去掉‘“+productId+”’最外层的‘’
      

  7.   

    我纠结,问题不明。
    猜吧:
    1.productId 旁边没有逗号
    2.productId 旁边字段没有空格
    3.productId 旁边有无效字符、符号
    4.productId 旁边有sql语句拼写错误
      

  8.   

    sql语句出问题啦,把sql语句贴出来看看
      

  9.   

    尽量不要用String写Sql,而用变量的好处有:
    1,防止语法出错,如德语,西班牙语等带逗号的常会出现SQL错误。
    2.安全方面大打折扣,如防止注入脚本等。
    3.不易维护,改别人的BUG时找起来很痛苦啊。
      

  10.   

    SQL语句怎么弄啊?在哪里啊? 我不会啊,救命啊,谁会的麻烦加下我QQ,谢谢了
      

  11.   

    就是那条,含有ProductID的代码。