I have a database that is part of a merge replication scheme that has a GUID in the form of PK. In particular, the data type is a unique identifier, the default value (newsequentialid ()), the RowGUID parameter is set to Yes. When I do InsertOnSubmit (CaseNote), I thought I could leave CaseNoteID on my own and the database would enter the next Sequential GUID, as if you manually entered a new line in the MSSMS. Instead, it sends 00000000-0000-0000-0000-000000000000. If I add CaseNoteID = Guid.NewGuid(), I will get a GUID, but not a serial one (I'm sure).
Is there a way to let SQL create the next sequential identifier in LINQ InsertOnSubmit ()?
Below is the code that I use to insert a new record into the database.
CaseNote caseNote = new CaseNote { CaseNoteID = Guid.NewGuid(), TimeSpentUnits = Convert.ToDecimal(tbxTimeSpentUnits.Text), IsCaseLog = chkIsCaseLog.Checked, ContactDate = Convert.ToDateTime(datContactDate.Text), ContactDetails = memContactDetails.Text }; caseNotesDB.CaseNotes.InsertOnSubmit(caseNote); caseNotesDB.SubmitChanges();
Based on one of the sentences below, I turned Autogenerated into LINQ for this column, and now I get the following error:> The target table of the DML statement cannot have triggers activated if the statement contains an OUTPUT clause without an INTO clause. Ideas?
c # guid linq
Refracted paladin
source share