Sql Server Error, Entity Framework Core Error: An unhandled exception occurred while processing the request. SqlException: Invalid column name 'ColumnName'. Invalid column name 'AnotherColumnName'.

Question: How do you resolve, An unhandled exception occurred while processing the request.
SqlException: Invalid column name 'ColumnName'.
Invalid column name 'AnotherColumnName'.

Microsoft.Data.SqlClient.SqlCommand+<>c.<ExecuteDbDataReaderAsync>b__164_0(Task<SqlDataReader> result)

 

Answer:

1. The answer could be pretty simple, there is a big chance that you "my friend" has misspelled the name of the Column somewhere in your code. This is when the Developer Instinct has to kick in. Slow down, and double-check the very column name with an error on. That same column name might very much be misspelled.

2. Go to your SQL Server Table where the column with an error is located, in the "Object Explorer" expand the dbo.TableName, then expand the "Column" folder. Again, Double-check if the column was created in the first place (in the table), if indeed the column was created, then check if it is the same as defined in your code.

 


Edit this Article
EF Core Error SQL Server Error Invalid column name Sql Server. Technology published
Was this page helpful?
Yes Yes! this solution to the problem was helpful. No No! this solution to the problem was not helpful.. Leave ErnesTech Feedback.Feedback
If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.

Your Session is Ending
Login to Continue

© 2021 - ErnesTech - Privacy