How to change to "Duplicates OK"?
I got an error message: "The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again. "
The SQL statement is:
string UserProjectPSQL = "INSERT INTO UserProject (UserID, ";
UserProjectPSQL += @"ProjectID, CreateDate) ";
UserProjectPSQL += @"VALUES (" +UserID+ ", " +intProjectID+ ", ";
UserProjectPSQL += @"'" +DateTime.Now.ToString()+ "')";
The UserProject table contains UserID as PK(Duplicates OK), ProjectID as PK(Duplicates OK), CreatedDate, and UserTypeCode. So, those values should be OK with duplicate values. How can I change the UPDATE statement?
Thanks,
|