So when I run the following, the role is inserted but the ID column is auto generated. How do I stop this from happening when using Linqpad?
Roles.InsertOnSubmit(new Role(){ID = 26, Name = "TheRole", Created = DateTime.Now, Updated = DateTime.Now});
SubmitChanges();
The ID column is set to AUTO INCREMENT in database, you can't override that from LINQ, you have to modify your database table schema to remove AUTO INCREMENT from table.
You can also enable IDENTITY_INSERT
if you are using ADO.Net, see this question for related SQL details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With