'/' 應用程式中發生伺服器錯誤。

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1

描述: 在執行目前 Web 要求的過程中發生未處理的例外狀況。請檢閱堆疊追蹤以取得錯誤的詳細資訊,以及在程式碼中產生的位置。

例外狀況詳細資訊: MySql.Data.MySqlClient.MySqlException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1

原始程式錯誤:


行 165:                                string ParentI0D1 = "";
行 166:                                mydbCmd.CommandText = "SELECT category, ParentID FROM categories WHERE id = " + ParentID0;
行 167:                                mydbDR = mydbCmd.ExecuteReader();
行 168:                                if (mydbDR.Read())
行 169:                                {

原始程式檔: d:\www\kmt-toy.com\httpdocs\products.aspx.cs    行: 167

堆疊追蹤:


[MySqlException (0x80004005): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1]
   MySql.Data.MySqlClient.MySqlStream.OpenPacket() +228
   MySql.Data.MySqlClient.NativeDriver.ReadResult(UInt64& affectedRows, Int64& lastInsertId) +62
   MySql.Data.MySqlClient.MySqlDataReader.GetResultSet() +48
   MySql.Data.MySqlClient.MySqlDataReader.NextResult() +516
   MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) +803
   MySql.Data.MySqlClient.MySqlCommand.ExecuteReader() +6
   products.Page_Init(Object sender, EventArgs e) in d:\www\kmt-toy.com\httpdocs\products.aspx.cs:167
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +52
   System.Web.UI.Control.OnInit(EventArgs e) +97
   System.Web.UI.Page.OnInit(EventArgs e) +14
   System.Web.UI.Control.InitRecursive(Control namingContainer) +142
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +416


版本資訊: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.8.4494.0