473,373 Members | 1,507 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,373 software developers and data experts.

Dataset ForeignKeyConstraint Error

I have a dataset with a parent table and 3 child tables. The dataset
is filled and manipulated on one particular web page. During the user
interaction one of the child tables can have records inserted,edited,
or deleted. Upon clicking save I call the Update method of my
dataAdapter mapped to the child table in my db and pass the dataset
childtable in as a parameter. I'm getting an inconsistent foreign key
constraint error. The error is telling me that a certain child key
value(1768) must exist in the parent table. The value I'm being given
is the parent primary key of one of the records in my database. The
strange thing is upon entry into the aspx page an entirely different
parent record and related children records were loaded into the
dataset. How am I getting this rogue child record in my dataset for an
entirely different parent record than the one I'me inserting child
records for? I thought I may be loading my dataset with more child
rows than I wanted but my dataset should give the same foreign key
constraint error if I try loading rogue child records without the
parent record in the parent datatable. Anyone seen this type of
bahavior before? I had a hunch that the auto generated SELECT
statement appended to the INSERT statement of my dataadapter may be
causing the issue so I got rid of it. Seems to have solved the
problem, but I would like to know if this truly is the solution, or if
I'm missing something else?

Any suggestions on how to properly debug this error or alternate
solutions are appreciated.
Nov 18 '05 #1
0 1458

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be...
by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be...
by: Dennis | last post by:
Hi, I am hoping I can get some help with a small problem I have run into using C#. U have an XML file that I load into a Dataset and then display this in a Datagrid. No problems doing this at all....
by: Lars Netzel | last post by:
A little background: I use three Datagrids that are in a child parent relation. I Use Negative Autoincrement on the the DataTables and that's workning nice. My problem is when I Update these...
by: jaYPee | last post by:
I have created 3 sqldataadapter. each adapter.selectcommand has a parameter. I have added a textbox to supply a value for each parameter. My problem is when I press enter the second time to fire up...
by: David A. Osborn | last post by:
I keep getting the following message when adding a new record to a database that has two tables. On table is a parent to the other. I am adding a new parent record that has child records and I...
by: dbuchanan | last post by:
Hello, Here is the error message; ---------------------------- Exception Message: ForeignKeyConstraint Lkp_tbl040Cmpt_lkp302SensorType requires the child key values (5) to exist in the...
by: J. Askey | last post by:
I am implementing a web service and thought it may be a good idea to return a more complex class (which I have called 'ServiceResponse') in order to wrap the original return value along with two...
by: Harry Strybos | last post by:
Visual Studio 2005 - SP1 - VB.Net on WinXP SP2 I add a typed dataset to my solution and get the following errors : Error 1 sub 'ReadXmlSerializable' cannot be declared 'Overrides' because it...
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.