The data reader is incompatible with the specified... A member of the type, 'Finalised', does not have a corresponding column in the data reader

entity entity-framework model sql-server-2008 visual-studio-2010

Question

I have added a column in my Sql Server Db then in VS i updated model from database, there a template auto generated some code.

The code compiled fine, but when i try access a the data base, the following error occurs:

The data reader is incompatible with the specified 'CompassModel.tbSalesContract'. A member of the type, 'Finalised', does not have a corresponding column in the data reader with the same name.

Finalised is the new column i added to my database.

Does anyone know how to track this down, and if so, is there a fix or methodology to follow to avoid in the future?

1
2
5/29/2012 10:52:36 AM

Accepted Answer

If you are using a SP then update the newly added column in that Or If you are using inline query put the exact name of the newly added column . The template you are talking about does not contain the newly added column name ..Try to edit the template ..the issue will be resolved.

5
5/29/2012 12:09:41 PM

Popular Answer

Hopefully this helps someone out but when I received this error I was trying to return an entity type from a stored procedure.

To fix this I had to add the correct function import mapping. In your edmx go to the Model Browser view and navigate to Funtion Imports. Right click your sproc name and select function import mapping. There you can map your sproc return results to the appropriate entity property.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow