asa asa - 1 year ago 124
SQL Question

How update string field with length of 300 with entity

I want to update one field of one table, the problem is when it goes to be bigger than 128 character SQL isn't let me to update.

The identifier that starts with … is too long. Maximum length is 128

The strange thing is I was adding 300 character with entity , but I can't update it.

Here is my code:

var objcompany = _entities.Companies.FirstOrDefault(o => o.Username == user.Trim());


Answer Source

Based On your Code.Update your model before saving to Database

_entities.Entry(objcompany).State = EntityState.Modified;//Add this Line 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download