Last post Jan 26, 2011 04:04 PM by garrygrimshaw
Jan 17, 2008 06:17 AM|Pztydr|LINK
I am getting the above error when trying to load a report into my Web Application, I have tracked the error down to one specific field in my database. Even though this field is a NVarChar field and is of size 30 it would seem that there is an issue
returning the value from the field. I can write it into the database no problems but when I try to get it out of the database it returns the above error.
MOB 401.908.804 - Fails
0401.907.324 - okay
8239 9082 (pager) - fails
Anyone got an idea on how to fix this????
Jan 17, 2008 08:28 AM|sainathdk|LINK
Are you using a typed data set or a tableadapter configured via a XSD file? If so, it may be that you changed a constraint in the database but did not update the adapter. If so, then updating the adapter/dataset would help fix this.
Jan 17, 2008 06:44 PM|Pztydr|LINK
It's being done via an SQLDataAdapter, there are no constraints, default values or foreign keys. I am returning only a single row.
Jan 17, 2008 06:53 PM|Motley|LINK
The error message you gave is unrelated to the data you have posted. Either you have a second error, or your assumption on what data is causing it is incorrect.
Jan 17, 2008 08:55 PM|sainathdk|LINK
Can you try doing what has been posted in the link below and then post the error details in this thread.
Jan 19, 2008 08:08 AM|Pztydr|LINK
Haven't fixed the problem but as this is supposed to be a phone field I have stripped out all the text and reformatted the remaining numbers. This has fixed my problem, as to why it was happening I have no idea.
Apr 02, 2008 07:27 AM|eldoissac|LINK
If the column size of the table is not matching with that of the typed dataset, this error will pop up. This can happen when you use a stored procedure that return a dynamically calculated field and the size is not mentioned in the typed dataset corerctly.
Jan 26, 2011 04:04 PM|garrygrimshaw|LINK
I spent hours trying to sort this, tried all the other various suggestions from other forums but nothing would work. It turned out to be a very simple fix for me and one of those "oh yeah, why didn't I think of that earlier" moments. Quite simply, it was
the order in which I was filling my datatables. I was filling the child table before filling the parent table. In this case I was trying to fill the Booking table before Delivery table, but the Delivery table contains the primary key. I
think I would have spent even more time on it if I hadn't used the datatable.GetErrors() method to produce a more understandable error message!
Catch ex As Exception
Dim ErrorRows() As Data.DataRow = ds.Booking.GetErrors()
For Each row As Data.DataRow In ErrorRows
Response.Write(row.RowError & "<br />")
Which produced - "ForeignKeyConstraint FK_Delivery_Booking requires the child key values (45) to exist in the parent table." - makes a bit more sense than "Failed to enable constaints. One or more rows blah blah blah....."