I am getting yelled at by sql server when I try to create a new row in my Jobs table through my C# code.
The Jobs table has a PK, Control. It is an integer. It is not an identity column. I am looking at it right now in SSMS and it says Identitfy Specification = No. (If I had designed this table, trust me it would've been identity = yes but I am trying to work with what I've got).
The code that is giving me a problem is the Update using a table adapter:
I exception and it says 'Cannot insert explicit value for indentity column in table 'Jobs' when IDENTITY_INSERT is set to OFF'.
So two questions, where is it set to off? And why would that even be relevant if it's not an identify field?
Oh, let me add, because I think this is relevant, that there is stored procedure that inserts Jobs records and it goes:
Because you should be allowed to insert a value for Control, and here you can, but why can't I in the code above?
Many thanks!
The Jobs table has a PK, Control. It is an integer. It is not an identity column. I am looking at it right now in SSMS and it says Identitfy Specification = No. (If I had designed this table, trust me it would've been identity = yes but I am trying to work with what I've got).
The code that is giving me a problem is the Update using a table adapter:
Code:
// Add the row we created to the table
dtDest.AddJobsRow(drDest);
int result = taJobs.Update(dtDest);
So two questions, where is it set to off? And why would that even be relevant if it's not an identify field?
Oh, let me add, because I think this is relevant, that there is stored procedure that inserts Jobs records and it goes:
Code:
INSERT Jobs
(Control, SONumber, ...
VALUES
(@NewControl, @SONumber, ...
Many thanks!