Click here to Skip to main content
15,895,781 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi again,

here is my code :
C#
int n = dsCfg.tblCfg.Columns.Count;

Object[] ao = new object[n];

ao[0] = "SETTINGS";
ao[1] = 0;
ao[2] = some value

dsCfg.tblCfg.LoadDataRow(ao,false);
taCfg.Update(dsCfg.tblCfg); // -> throws exception : cannot insert duplicate PRIMARY KEY

tblCfg has 6 columns : 0=nchar(10), 1=int, all others are type sqlvariant; 0 and 1 build PRIMARY KEY

so if it can't insert why doesn't it up ?
any help (except try this... (means i don't want to rewrite the project)) appreciated

thanks in advance
Posted
Updated 14-Feb-13 3:32am
v2
Comments
Richard MacCutchan 14-Feb-13 10:01am    
I think that message is trying to tell you something.
Richard C Bishop 14-Feb-13 10:15am    
As Richard said, you cannot insert a duplicate primary key. That is your answer, you are attempting to do that and you cannot.

1 solution

hi,

got it : TableAdapter's Fill-Methode was missing !

now works fine !
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900