Unknown column in 'field list' MySQL Exception

-1

how to fix this

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
c#
mysql
asp.net
ado.net
mysql-connector
asked on Stack Overflow May 15, 2019 by Yasiru • edited May 15, 2019 by Panagiotis Kanavos

3 Answers

4

please Check your table like this id has into table @ProductTypeId

answered on Stack Overflow May 15, 2019 by Ramesh
0

The error is basically saying that something you are trying to use doesn't match up with what the database has.

Please make sure @ProductTypeId exists in database.

answered on Stack Overflow May 15, 2019 by Wildan Muhlis • edited May 15, 2019 by Wildan Muhlis
0

I found the problem it was in insert SP CREATE DEFINER=root@localhostPROCEDUREproduct_insert( INProductTypeIdint(11),

@ is missing IN@ProductTypeIdint(11)

answered on Stack Overflow May 15, 2019 by Yasiru

User contributions licensed under CC BY-SA 3.0