我正在开发一个使用 asp.net mvc 2 和 linq to sql 的项目。当尝试将数据插入具有tinyint 标识列类型的表时,会出现此问题。尝试插入时出现以下错误:
The primary key column of type 'TinyInt' cannot be generated by the server.
linq to sql支持tinyint数据类型吗?
请帮助我
最佳答案
据我所知,Linq To Sql 不支持 TinyInt 自动增量字段。
可以将数据类型更改为smallint 或int 吗?
请参阅 Microsoft Connect 上的以下线程:
When you have a table with an identity field of tinyint and it's set to auto increment, you can't add a new record to that table. LINQ says, 'The primary key column of type 'TinyInt' cannot be generated by the server'
Thank you for taking the time to send this feedback and bug report. We have reviewed the issue and confirmed the behavior, but we will not be fixing this in the next release of LINQ to SQL.
关于asp.net-mvc - asp.net mvc linq sql问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2820128/