小新二三事 二三事 電視精/戲院 ASP .NET 新手工作日誌

2009年7月10日星期五

ASP.NET Warning: Cannot insert explicit value for identity column in table 'Table' when IDENTITY_INSERT is set to OFF

ASP.NET Warning: Cannot insert explicit value for identity column in table 'Table' when IDENTITY_INSERT is set to OFF

Things to check

1. Set table id as (Is Identity) to Yes
1a. Set table id as (Primary Key)

2. Make a new SqlDataSource with INSERT command
Coz after you change table id, SqlDataSource will not be updated auto.

3. Check the INSERT command with original SqlDataSource
Should have difference

沒有留言: