Maximum number of columns in a LINQ to SQL object?

I have 62 columns in a table in SQL 2005 and LINQ to SQL does not handle updates, although the read will work very well, I tried to re-add the table to the model, created a new data model, but nothing worked, I assume I hit maximum number of columns per object, can anyone explain this?

+1


source to share


3 answers


I suspect there is some problem with the identity sheet or timestamp (something autogenerated in the SQL server). Make sure any column that is autogenerated is marked this way in the model. You can also see how it handles concurrency. If you have triggers that update any values ​​in a row after an update (change values) and check all columns on updates, this will cause the update to fail. I usually create tables with a timestamp column - LINQ2SQL picks this when creating the model and only uses it for concurrency.



+1


source


Resolved, either one of the following two

-I am using UniqueIdentifier column which was not set as primary key

-Configure a primary key with a unique id, check the properties of the same column in Server Explorer and it still didn't show up as the primary key, updated the connection, deleted the same table in the model and voila.



So my guess is that some time ago I made changes to my model, deleted the table from the model and added the same from the server explorer without refreshing the connection, and never worked.

The question is, does VS Server Explorer support its own table schema and requires updating the connection every time a change is made to the database?

+1


source


There is no limit to the number of columns that LINQ to SQL can handle.

Do you have other tables updating successfully?

What's the other difference in how you access the contents of the table?

0


source







All Articles