L
Liming
Hi,
I designed a few DataSet Tables in the typed dataset dsigner. Recently,
I encountered an error saying
Failed to enable constraints. One or more rows contain values violating
non-null, unique, or foreign-key constraints.
I didn't have any relations or non null values in the table, so I
didn't know what was going on. I debugged by manually query the same
sql and injected it into the typed datatable. When errors happen, I
loop through each row in errors and the columns in error and found out
that one my column's value exceeded the maxium length allowed. I
printed out the maxium length, it was "10" when in database, it's "50".
The issue here is, originally when the data table was added into the
designer, db had a value "10".. I changed it later to "50".. but the
dataset designer did not reflect this new change and now an error was
thrown (if I didn't know how to manually loop through the error rows, I
wouldn't even know what happened)
I'm wondering how do you tell VS2005 designer to refresh its datatable
definition? I don't see a "refresh" option or anything. (right now, I
just go manually update it) But it would be nice to have a refersh
option.
In addition, why that when I was inserting, no error happened? How do
you make it so that it auto truncate anystring that exceed the allowed
maxlenght?
Thanks.
I designed a few DataSet Tables in the typed dataset dsigner. Recently,
I encountered an error saying
Failed to enable constraints. One or more rows contain values violating
non-null, unique, or foreign-key constraints.
I didn't have any relations or non null values in the table, so I
didn't know what was going on. I debugged by manually query the same
sql and injected it into the typed datatable. When errors happen, I
loop through each row in errors and the columns in error and found out
that one my column's value exceeded the maxium length allowed. I
printed out the maxium length, it was "10" when in database, it's "50".
The issue here is, originally when the data table was added into the
designer, db had a value "10".. I changed it later to "50".. but the
dataset designer did not reflect this new change and now an error was
thrown (if I didn't know how to manually loop through the error rows, I
wouldn't even know what happened)
I'm wondering how do you tell VS2005 designer to refresh its datatable
definition? I don't see a "refresh" option or anything. (right now, I
just go manually update it) But it would be nice to have a refersh
option.
In addition, why that when I was inserting, no error happened? How do
you make it so that it auto truncate anystring that exceed the allowed
maxlenght?
Thanks.