I am getting the exception "Cannot insert the value NULL into column 'ID'" when using Linq to Sql , I am leaving the ID property blank , but I have set my ID to auto-generate in my DBML file. This will work fine when I insert without an ID and let sql auto generate for me not using linq. The problem is LINQ is throwing an exception because it sees that ID is empty , even though if LINQ would just let it go through SQL is ok with it.
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ID", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
public int ID
{
get
{
return this._ID;
}
set
{
if ((this._ID != value))
{
this.OnIDChanging(value);
this.SendPropertyChanging();
this._ID = value;
this.SendPropertyChanged("ID");
this.OnIDChanged();
}
}
}