none
LINQ Insert Produces Double Entries RRS feed

  • Question

  •  Dim db As New EventDataContext
     Dim mv As New A_Event With _
         {.OwnerID = UserInfo.UserID, _
           .EventCancelled = 0, _
           .EventRecalled = 0}
     db.A_Events.InsertOnSubmit(mv)
     db.SubmitChanges()

    When executed this code inserts two records into the database. I'm creating a module for DotNetNuke and have it's Ajax support turned on through 'Supports Partial Rendering'. Even when the Ajax support is disabled the code still creates two records. I've removed most of the original code and ended up with this small bit and I'm stumped as to why I'm getting double records. Has anyone else seen the behavior?

    Thanks

    Thursday, July 16, 2009 4:00 PM

Answers

  • You might want to try turning on logging (set the .Log property of the data context to a writer) to see what TSQL is being generated and also set a breakpoint on the submitchanges line to ensure this block of code is only getting called once.

    [)amien
    Saturday, July 18, 2009 5:18 PM
    Moderator