I have a table that the primary key field has a default value of newid() --> that generates a unique id every time a record gets inserted. when I try to insert a record directly in the database from any sql management tool, it works. but when I try to use C# linq-sql insert it gives my the below error:
Cannot insert the value NULL into column '', table ''; column does not allow nulls. INSERT fails. The statement has been terminated.
why is linq ignoring the default value of the field, and is there any alternative way of doing this, given that I don't want the normal sequential int id in the primary key below is the c# code for the insert:
databaseDataContext db = new databaseDataContext();
order c = new order();
c.orderName = "Untitled";
c.orderStatus = "New";
db.orders.InsertOnSubmit(c);
db.SubmitChanges();