如何解决此问题
MySql.Data.MySqlClient.MySqlException (0x80004005): Unknown column '@ProductTypeId' in 'field list'
↵ at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
↵ at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
↵ at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
↵ at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
↵ at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
↵ at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
↵ at System.Data.Common.DbCommand.ExecuteNonQueryAsync(CancellationToken cancellationToken)
↵--- End of stack trace from previous location where exception was thrown ---
↵ at EwingsPlatform.Core.Repositories.Implementations.ProductRepository.InsertAsync(Product entity) in D:\01_New Product\New folder\master\EwingsPlatform.Core\Repositories\Implementations\ProductRepository.cs:line 292
↵ at EwingsApp.Controllers.ProductController.PostApplicationProduct(CreateProductViewModel applicationProduct) in D:\01_New Product\New folder\master\EwingsPlatform.AdminWeb\Controllers\ProductController.cs:line 166
↵ at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
↵ at System.Threading.Tasks.ValueTask`1.get_Result()
↵ at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
↵ at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
↵ at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
↵ at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
↵ at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
↵ at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
↵ at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
↵ at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
↵ at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
↵ at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
↵ at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext)
↵ at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.Invoke(HttpContext httpContext)
↵ at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
↵ at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
↵ at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)"
StatusCode: 500
答案 0 :(得分:4)
请检查您的表是否已将此ID插入表@ProductTypeId
答案 1 :(得分:0)
该错误基本上是说您要使用的内容与数据库的内容不匹配。
请确保数据库中存在@ProductTypeId
。
答案 2 :(得分:0)
我发现问题在于插入SP
CREATE DEFINER=
根@
本地主机PROCEDURE
product_insert (
IN
ProductTypeId int(11),
@缺少IN
@ ProductTypeId int(11)