473,387 Members | 1,611 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,387 software developers and data experts.

InvalidConstraintException

Roy
I add a DataRelation to a DataSet as following

DataRelation dr = new DataRelation("relation", parentTablePrimaryKeyColumns,
childTablePrimaryKeyColumns);
myDataSet.Relations.Add(dr);

The parant table and child table has a one-one relation. When I call
myParentTable.Clear(), I got the error:
System.Data.InvalidConstraintException : Cannot clear table myParentTable
because ForeignKeyConstraint relation enforces constraints and there are
child rows in myChildTable.

I checked the DeleteRule and it was Rule.Cascade. So I assumed the records
in child table should have been removed automatically.

Why?
Mar 17 '06 #1
0 1240

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

Similar topics

1
by: jesse.hartwick | last post by:
Hey.. I was just wondering why there are so many ways to reference a form and what are the pros and cons of using each. I've seen at least 5 different ways, which is correct (or in what...
3
by: juli jul | last post by:
Hello,following this code I got an error message: the code: System.Data.DataRelation dr; System.Data.DataColumn dc1; System.Data.DataColumn dc2; // Get the parent and child columns of the two...
2
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....
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.