Exception: Primary key information is not present

dr_maq

New member
Joined
Feb 10, 2005
Messages
1
Location
Lahore, Pakistan
AoA Dears,

i m having a problem with inserting value in SQL Server 2000 through C# Code
the table in which i m going to insert values have a composite primary key(combination of 4 DataColumns)
when i load DataSet, i set these four DataColumns as primary key using following C# code

DataColumn[] keys = new DataColumn[4];
keys[0] = dsRole.Tables["SECURITY_GROUP_ROLES"].Columns["GROUP_ID"];
keys[1] = dsRole.Tables["SECURITY_GROUP_ROLES"].Columns["ROLE_TYPE"];
keys[2] = dsRole.Tables["SECURITY_GROUP_ROLES"].Columns["CATEGORY_ID"];

keys[3] = dsRole.Tables["SECURITY_GROUP_ROLES"].Columns["FORUM_ID"];

dsRole.Tables["SECURITY_GROUP_ROLES"].PrimaryKey = keys;

when i update existing record in this table, it works fine. but when i insert new record in this table, it gives an error at Updateing DataSet that

[SqlServerCommandBuilder] ConcreteGetInsertCommand()Primary key information is not present


i have already set primay key but why its giving this error

Can any body tell me the solution of this problem

One point more. DataTable that have a single column as primary key, are working fine. But having composite key is not working fine
waiting for ur urgent reply

Thanks in advance
 
Back
Top