Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SaveDataSet Not Generating enough AutoIncrKeys
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
SaveDataSet Not Generating enough AutoIncrKeys
Divers
Thread ID:
01102222
Message ID:
01102222
Vues:
62
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform