SQL Server 2005 - InfoPath Dev
in

InfoPath Dev

SQL Server 2005

Last post 09-14-2009 05:14 PM by Hilary Stoupa. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 09-11-2009 10:16 AM

    SQL Server 2005

    I have seen many posts related to this but not one specific to mine. If there is one I apologize for taking everyone's time.

    I have an SQL Server 2005 database with InfoPath 2007 SP 1. In the database I have one table (demographics) with a primary key that has a simple relationship to about 10 other tables. My InfoPath form has a non-repeating section for the demographics table and repeating sections for the other tables.

    Entry of a record into the demographics and other tables works fine. When I open an existing record, edit either the demographics table or one of the other tables, I receive the following error:

    Violation of PRIMARY KEY constraint 'PK_demographics'. Cannot insert duplicate key in object 'dbo.demographics'.

    I don't want to insert at this point, I want to update. How can I do this?

    Thanks in advance and best regards,

    John

  • 09-13-2009 06:34 AM In reply to

    Hi:

    And you are using built in InfoPath functionality? You query for the record in the form, then make a change, then submit?

    Hilary Stoupa

  • 09-14-2009 06:01 AM In reply to

    I am using basic functionality. But no, I have saved the record along with submitting it. So I open the record from the view of all saved records. It appears that this is where the problem is. If I query the record from the form, edit it, then submit it, it works. But if I open the record from the view, it doesn't work.

  • 09-14-2009 05:14 PM In reply to

    Hmmm. I'm not sure what you mean by opening the record from the view -- so, you save the record and leave the form open, then there is another view that shows all the records that the user can select from? When I searched the web for the error you were getting, I saw an old post on a Microsoft news group that suggested the primary key field in the query nodes needs to be populated for the update statement to run correctly -- perhaps when the user selects the record from your view, you could try updating the field in the query fields that holds your primary key with the PK of the item selected?

    Hilary Stoupa

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.