473,513 Members | 2,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ForeignKeyConstraint

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 get the following:

ForeignKeyConstraint drtblCDstblSongs requires the child key value(9) to
exist in the parent table. Do you want to correct the value? Is there a
way I can just turn this off since with my program the only way to add a
child is to add the parent at the same time.

Nov 21 '05 #1
1 1686
David A. Osborn wrote:
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 get the following:

ForeignKeyConstraint drtblCDstblSongs requires the child key value(9) to
exist in the parent table. Do you want to correct the value? Is there a
way I can just turn this off since with my program the only way to add a
child is to add the parent at the same time.


You need to add the parent record, then get the value of the foreign
key. then add the child record with using that foreign key. Why do you
want to remove this if it is enforcing your rules?

Chris
Nov 21 '05 #2

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

Similar topics

0
1461
by: oj | last post by:
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...
1
988
by: Agnes | last post by:
For single datagrid, i can bind the table very well, I can add myGridTablestyle to the datagrid. However, after i set the relations before dgParents and dgDetails. It ignore my tablestyle()....
1
2635
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...
13
10088
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...
27
3741
by: max | last post by:
Hello, I am a newbye, and I'm trying to write a simple application. I have five tables with three columns; all tables are identical; I need to change some data in the first table and let VB...
0
7257
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7157
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7521
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5682
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1591
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.