Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am getting this error

The specified cast from a materialized 'System.Int16' type to a nullable 'System.Decimal' type is not valid.






here is code

XML
dataSource.Database.Connection.Open();

               // Run the sproc
               var reader = cmd.ExecuteReader();

               // Read first result set
               verbatim_Fields = ((IObjectContextAdapter)dataSource)
                   .ObjectContext
                   .Translate<Verbatim_Info_ValuesBO>(reader, "Verbatim_Info_Fields", MergeOption.AppendOnly).ToList();

               // Move to second result set and read Posts
               reader.NextResult();

               verbatim_SurveyData = ((IObjectContextAdapter)dataSource)
                   .ObjectContext
                   .Translate<AGLR__Survey_DataBO>(reader, "AGLR__Survey_Data", MergeOption.AppendOnly).ToList();
Posted
Comments
Madhav Hatwalne 6-Jun-14 5:12am    
is this issue in procedure or code?? If it's a code i think some else code is creating issues
Bernhard Hiller 6-Jun-14 8:43am    
Is there a database? If so, MS SQL Server, Oracle, other? And how is the corresponding column defined there?

1 solution

Well..i'm not a big EF expert,but it seems some field in the database is an int and in your entity model is a nullable Decimal. I would change type in your model and make it an int.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900