J
Jim Heavey
Hello, I have run into something that I can not explain or figure out how
to overcome. I am getting the following error when when I do a "fill"
method of the dataAdapter - "Failed to enable constraints. One or more rows
contain values violating non-null, unique, or foreign-key constraints."
Through a process of elimination, but eliminating all foreign keys, making
all fields accept nulls, I have determined that by removing the primary key
on this table, the table loads just fine. So now I have all of the foreign
keys put back and each field does not allow nulls.
How could this be? I am pulling my data from a SQL database which
identifies this field as the primary key. The field in question is a guid
field. Here is the code I used for defining this table...
DataTable dtSkaters = new DataTable("Skaters");
dtSkaters.Columns.Add("ClubID",typeof(Guid ));
dtSkaters.Columns.Add("FirstName", typeof(String));
dtSkaters.Columns.Add("MiddleName", typeof(String));
dtSkaters.Columns.Add("LastName", typeof(String));
dtSkaters.Columns.Add("SkaterID", typeof(Guid));
// set up primary key for Skaters Table
DataColumn[] pkSkaters = { dtSkaters.Columns["SkaterID"]};
dtSkaters.PrimaryKey=pkSkaters;
I have visible looked at the table in Query Analyzer and can see no
duplication, So why amd I getting this error?
Thanks in advance for your assistance!!!!!!!!!!!!
to overcome. I am getting the following error when when I do a "fill"
method of the dataAdapter - "Failed to enable constraints. One or more rows
contain values violating non-null, unique, or foreign-key constraints."
Through a process of elimination, but eliminating all foreign keys, making
all fields accept nulls, I have determined that by removing the primary key
on this table, the table loads just fine. So now I have all of the foreign
keys put back and each field does not allow nulls.
How could this be? I am pulling my data from a SQL database which
identifies this field as the primary key. The field in question is a guid
field. Here is the code I used for defining this table...
DataTable dtSkaters = new DataTable("Skaters");
dtSkaters.Columns.Add("ClubID",typeof(Guid ));
dtSkaters.Columns.Add("FirstName", typeof(String));
dtSkaters.Columns.Add("MiddleName", typeof(String));
dtSkaters.Columns.Add("LastName", typeof(String));
dtSkaters.Columns.Add("SkaterID", typeof(Guid));
// set up primary key for Skaters Table
DataColumn[] pkSkaters = { dtSkaters.Columns["SkaterID"]};
dtSkaters.PrimaryKey=pkSkaters;
I have visible looked at the table in Query Analyzer and can see no
duplication, So why amd I getting this error?
Thanks in advance for your assistance!!!!!!!!!!!!