Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SaveDataSet Not Generating enough AutoIncrKeys
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
SaveDataSet Not Generating enough AutoIncrKeys
Miscellaneous
Thread ID:
01102222
Message ID:
01102222
Views:
61
I have a table with 3 fields

ID (PK)
MDCMainId int
PacketId int

boPacketLists is the name of the bizobj class.
RetrieveAutoIncrementPK is set to true

I have a method of a bizobj that adds a series of rows to the table
using NewRow, and then setting the values
boPacketLists oPL = new boPacketLists();

foreach(DataRow oRow in this.GetCurrentDataSet().Tables[0].Rows)
{
	oPL.NewRow();
	oPL.DataRow["MDCMainId"] = oRow["id"];
	oPL.DataRow["PacketId"] = iPacketId;				
}

oPL.SaveDataSet();
The rows are all added successfully to the dataset, but when SaveDataSet is called, it using the same value for ID, and therefore the following error is generated

Column 'ID' is constrained to be unique. Value '36' is already present.

Any ideas??

Thanks,
Rick
Rick Hodder
MCP Visual Foxpro
C#, VB.NET Developer
Independent Consultant
www.RickHodder.com
MyBlog
Next
Reply
Map
View

Click here to load this message in the networking platform