Can't set auto-increment via SQL Server Express Management Studio?
How is your Linq-to-SQL model defined?? Check the properties of the user_id
column - what are they set to??
In your Linq-to-SQL model, be sure to have Auto Generated Value
set to true, Auto-Sync
set to OnInsert
, and the server data type should also match your settings (INT IDENTITY
),
In SQL Server Management Studio, you need to define the user_id
column to be of type INT IDENTITY
- in the visual table designer, you need to set this property here:
It is zero because you have a integer for a primary key column type. To use auto-increment, set tables identity column to the ID (selected in the table properties)
Would probably be easier to edit the database using VS if you have a version that will work for, otherwise if you have to edit it in management studio see this article:http://blogs.msdn.com/b/sqlexpress/archive/2006/11/22/connecting-to-sql-express-user-instances-in-management-studio.aspx