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)

 


Please Login to see the rest of the answer

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.

 


Write an Article
If you log in, you will be notified when someone leaves a comment.

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


© 2022 - ErnesTech - Privacy