Insert fails with BIGINT

18 posts, 0 answers
  1. G. Deward
    G. Deward avatar
    9 posts
    Member since:
    Jan 2012

    Posted 20 May 2012 Link to this post

    Please help me understand why I am receiving the following error this while attempting to insert into a table:

    Failed to retrieve the automatically incremented column value from the server.
    Possible reason: A trigger does not perform 'select ID from inserted' as last operation.

    The DDL from the table:
    CREATE TABLE [Communications].[DomainPart](
        [PartID] [bigint] IDENTITY(1,1) NOT NULL,
        [ParentPartID] [bigint] NULL,
        [PartText] [varchar](64) NOT NULL,
     CONSTRAINT [PK_DomainPart] PRIMARY KEY CLUSTERED
    (
        [PartID] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    The code performing the insert:
    using (var context = new Data.GlobalResourcesEntitiesModel())
    {
        foreach (string part in parts)
        {
            // Try to load existing item
            if (lastItem == null)
            {
                curItem = context.DomainParts.Where(p => p.ParentPartID.Equals(null) &&
                    p.PartText.Equals(part, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
            }
            else
            {
                curItem = context.DomainParts.Where(p => p.ParentPartID.Equals(lastItem.ParentPartID) &&
                    p.PartText.Equals(part, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
            }
     
            // If item exists then continue
            if (curItem != null)
            {
                lastItem = curItem;
                continue;
            }
     
            // Attempt to create it
            curItem = new DomainPart()
            {
                PartText = part
            };
            if (lastItem != null) { curItem.ParentPartID = lastItem.PartID; }
            context.Add(curItem);
            context.SaveChanges();
            if (curItem.PartID <= 0) { return null; }
            lastItem = curItem;
        }
    }

    Thanks, in advance.

    - Greg D.
  2. G. Deward
    G. Deward avatar
    9 posts
    Member since:
    Jan 2012

    Posted 20 May 2012 Link to this post

    Nevermind.  The error was bogus.  Telerik SHOULD have reported a unique constraint collission.  As soon as I noticed that I was using the wrong property on the check the item was able to save correctly.
    else
    {
        curItem = context.DomainParts.Where(p => p.ParentPartID == lastItem.PartID &&
            p.PartText.Equals(part, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
    }
  3. DevCraft banner
  4. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 21 May 2012 Link to this post

    Hello Greg,

    thanks for reporting this issue. We've identified a path where the original exception from the server could be missed, and will fix this for the next version.

    Greetings,
    Thomas
    the Telerik team
    Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
  5. JAY
    JAY avatar
    3 posts
    Member since:
    Dec 2014

    Posted 17 Aug 2015 Link to this post

    Hello, we are receiving the same error after we applied MS15-058 SQL Server patch on SQL 2012. When we roll back the patch, it is working fine.

    Failed to retrieve the automatically incremented column value from the server.

    Possible reason: A trigger does not perform 'select ID from inserted' as last operation.​"

  6. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 19 Aug 2015 Link to this post

    Hello Jay,

    it seems you are using an older version of OpenAccess; is that information right? A colleague of mine tried to reproduce the same issue here (with installed server patch), but could not get into the problem with newer versions of OpenAccess.
    In case you are using an older version, can you update and try again?

    Regards,
    Thomas
    Telerik
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
  7. JAY
    JAY avatar
    3 posts
    Member since:
    Dec 2014

    Posted 19 Aug 2015 in reply to Thomas Link to this post

    Hello Thomas,

     Thanks for the quick reply. We are currently using version 2013.2.702.1. Is it possible your team can try using this version (with the server patch) and confirm the issue ?

     Thanks

    Jay

  8. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 20 Aug 2015 Link to this post

    Hello Jay,

    we have been trying to reproduce this with the exact version that you mentioned with the server path, but we had no success in doing so. Is it possible to give us a reproduction case?

    Regards,
    Thomas
    Telerik
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
  9. JAY
    JAY avatar
    3 posts
    Member since:
    Dec 2014

    Posted 20 Aug 2015 in reply to Thomas Link to this post

    Hello Thomas,

    My colleague has already created a support ticket 962788.

    We do have an environment we are able to reproduce the issue. Can we setup a web-ex so we can demo the issue ?

     Thanks

    Jay

  10. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 21 Aug 2015 Link to this post

    Hi Jay,

    thanks to your colleague for sending us a reproduction code. We are looking into this and will let you know about the outcome.

    Regards,
    Thomas
    Telerik
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
  11. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 21 Aug 2015 Link to this post

    Hello Jay,

    we identified this to be caused by a changed version format string (from the applied patch) that fools our runtime. We plan to release a fixed version (via NuGet) soon, probably during next week.

    We apologize for the inconvenience this has caused.
    Thomas
    Telerik
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
  12. Thomas
    Thomas avatar
    2 posts
    Member since:
    Mar 2013

    Posted 16 Sep 2015 in reply to Thomas Link to this post

    Is this problem already been solved? We are facing exactly the same problem
  13. Viktor Zhivkov
    Admin
    Viktor Zhivkov avatar
    291 posts

    Posted 18 Sep 2015 Link to this post

    Hi Thomas,

    We have uploaded hotfix release for Telerik Data Access NuGet packages that you can get from www.nuget.org. The latest patched package is versioned as 2015.2.624.2. Please update all your existing Telerik Data Access packages to that version.
    If you are using previous version of our NuGet packages and you have concerns about updating to the latest, please let us know so we can give you a hand in the process.

    Regards,
    Viktor Zhivkov
    Telerik
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
  14. Matt
    Matt avatar
    1 posts
    Member since:
    May 2013

    Posted 30 Oct 2015 in reply to Viktor Zhivkov Link to this post

    Hi Viktor,

    Is there any prospect of a hotfix for the 2015.1.* version of Data Access to fix this for people like me who are locked into this version for the medium-term due to the scale of rework required to migrate to the new approach? I have been hit by the bigint INSERT issue out of the blue today following an upgrade of a SQL 2012 database.  I now face having to alter the datatype of the primary key on every table in the system to get things working again​.

    Thanks,

    Matt.

     

  15. Doroteya
    Admin
    Doroteya avatar
    502 posts

    Posted 05 Nov 2015 Link to this post

    Hello Matt,

    Introducing such a patch for Data Access Q1 2015 is a topic that we intend to discuss. I'll make sure to update this thread with the appreciate information once I have it.

    Thank you for your understanding.


    Regards,
    Doroteya
    Telerik
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
  16. Doroteya
    Admin
    Doroteya avatar
    502 posts

    Posted 07 Dec 2015 Link to this post

    Hi Matt,

    There's a hot fix for the Telerik.OpenAccess.Runtime assembly version 2015.1.225. You can find it attached to this message. In order to use it, you need to paste the new assembly in the install folder of Data Access on your machine and to install it in GAC (overwriting the existing one). Once you do this, make sure to clean your solution and rebuild it. Additionally, when you decide to deploy your applications make sure that they are configured as described in this blog post.

    As a note, you will have to perform the same process again if you install Data Access Q1 2015 on another machine or if you re-install it.

    I hope this helps. Let me know if you have further questions.


    Regards,
    Doroteya
    Telerik
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
  17. Daniel
    Daniel avatar
    3 posts
    Member since:
    Sep 2008

    Posted 22 Jul Link to this post

    Dear support,

    we're currently referencing version 2012.2.607.1 of the Telerik.OpenAccess assemblies in our projects.

    Now we're faced with the identical effect when installing the Windows Update KB3162659.
    As you point out in the readme file of the hotfix, the issue is not limited to this specific Windows Update. Any update for different SQL server versions that converts the SQL version format string to the not supported forma, breaks the Telerik runtime.

    Is there also a hotfix for the mentioned assembly version 2012.2.607.1.
    Are there other options of how to overcome this issue besides updating to Telerik version 2015 and then apply the hotfix?

    Please let me know, if you require more detailed information.

    Best regards,

    Markus

  18. ES
    ES avatar
    6 posts
    Member since:
    May 2015

    Posted 22 Jul Link to this post

    Dear support,

     

    we are also using 2012.2.628.2 - and getting this error now on a SQL 2008 R2 (10.50.6542)

    If you have any recommendations in upgrading, go ahead. We use a single context for the whole lifetime in a WinForms UI - somebody told me that this is a problem.

    We also rely on the designer heavily ... so we have to use the last version where designer is supported.

     

    Thanks in advance!

  19. Doroteya
    Admin
    Doroteya avatar
    502 posts

    Posted 27 Jul Link to this post

    Hi,

    Our general recommendation for situations like those you describe is to upgrade Data Access to at least Data Access Q1 2015, and to install the available hotfix (more details are available in this forum post). Note that, although there's a hotfix for this version it supports Visual Studio up to version 2013.

    The more permanent solutions that will allow you to update your applications in a more convenient way in the feature are described in the options listed in this forum post.

    I hope this helps.

    Regards,
    Doroteya
    Telerik by Progress
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
Back to Top
DevCraft banner