Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • Hi Thanks for your response. I am receiving the below error while executing "{"\r\n(138,10) : error 3004: Problem in mapping fragments starting at line 138:No mapping specified for properties Create.citylist, Create.cityList in Set grp.\r\nAn Entity with Key (PK) will not round-trip when:\r\n Entity is type [mvcdemo.Models.Create]\r\n"} Commented Jan 20, 2015 at 7:42
  • @user3793029, That error is not related to the code in my answer. Its due to your code for updating the database. Debug you code to determine which line is causing the error. Google "error 3004: Problem in mapping fragments starting at line" to see if you can find a solution, and if not you need to ask a new question. Commented Jan 20, 2015 at 12:19
  • Hi, I got the solution. I just added new field called newcityname as you mentioned. But i don't want to add newcityname in my table. For now, i added and it works well. Thank you so much for your help. Commented Jan 20, 2015 at 12:33
  • You don't need to add the field in your table. I have shown you how to do it with a view model CreateVM which is not the same as your data model Create. You need to map the properties from you view model to the data model. See What is a view model in MVC Commented Jan 20, 2015 at 12:37
  • Its not entirely clear from your question, but I think all you are wanting to do is update an existing city name with a new name, in which case you just want something like UPDATE tblcity SET cityname = @NewName WHERE cityname = @OldName and pass the parameters from the view model Commented Jan 20, 2015 at 12:41