asp.net-mvc - asp.net mvc linq sql问题

标签 asp.net-mvc linq-to-sql auto-increment tinyint

我正在开发一个使用 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/

相关文章:

c# - 可以在 c# linq 的查询表达式中使用 take 而不是使用 .Take(x) 吗?

linq-to-sql - 插入新记录时如何获取主键值?

sql - 将带有 id 的行插入到具有自动增量的表中

mysql - 为现有表添加自增ID?

c# - 为什么我应该在 LINQ to SQL 中使用 IQueryable<T> 而不是 List<T>

mysql - 从自动递增字段mysql java中知道下一个值

c# - 在 ASP.NET MVC 应用程序中锁定一个全局对象时是否可能出现死锁?

C# SwaggerGen + AutoRest - 如何发送流主体?

asp.net-mvc - 我可以在同一个 AppHarbor 站点上运行 MVC 应用程序和 WCF Web Api 吗?

asp.net - 在asp.net mvc2中如何打开新窗口并下载文件