|
-
Jun 15th, 2012, 10:27 PM
#4
Re: tableadapter.update
The fact that you want to use a foreign key is not a reason to use the code as a primary key. It's not essential but I use an auto-generated number as an ID in every table, specifically an int or bigint set as an identity in SQL Server. That ID is then used as a foreign key in related tables. I've never used Pervasive so I'm not sure what the equivalent would be, but I'm sure that there would be one.
As for your code, I can't see anything just looking through it. I would suggest that you step through the code line by line and check the contents of your DataTable at each point. I just can't really see how you could be inserting a row that already exists, so you'll need to determine at exactly what stage things go wrong. In theory, the adapter is just going to save changes from the DataTable so that would suggest that the contents of your DataTable are not what you think they are before you call Update.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|