Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Location
    Scotland
    Posts
    7

    Unanswered: DataAdapter Update and no primary key

    Hi,

    Get this error message
    "could not determine whcih columns uniquely identify the rows for "Table""

    Works ok for Select and Insert. Problems arise when dealing with Update, Delete, due to no primary key in the table.

    Is there a way of allowing a DataAdapter to Update to a Table without a Primary Key????

    Your help would be most appreciated. This is a real show stopper. Thanks.

    Stuart

  2. #2
    Join Date
    Jan 2004
    Posts
    4
    I had the same problem & couldn't figure out how to make it work with NO key, but it works fine with a composite key...e.g., in my case a record is uniquely identified by two fields (Site ID & Contact name). Neither field alone is enough. You can use all the fields in the table if you have to.

  3. #3
    Join Date
    Nov 2003
    Location
    Scotland
    Posts
    7
    Hi SaxGirl,

    Up until yesterday, I would have completely agreed with you. Was on to microsoft support and they suggested using technique layed down at the website http://support.microsoft.com/?id=308055 Go by Code Sample 2.

    It's basically saying that the whole row is a primary key. i.e. that row will never be repeated, so therefore is unique. However, what most users can do is copy and paste from a previous row into the AddNewRow for DataGrid.

    If they then save this to the db. Next time someone changes, any one of these rows, it'll change the other row as well.

    Thanks for posting, and up until yesterday, I would have agreed. Please be sure to test your code to see if this loop hole is there. Can you let us know of your outcome.

    Either way, you'll get to see a potential issue, or if yours works I could finally have my solution.

    Thanks so much for posting Saxgirl,

    Stuart

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •