Hi
I have a DataSet with several DataTables. I have set up relations between
these tables.
I want to delete all the tables and re-fill them. However, when I try to do
so, even after using Relations.Clear() I still get excecptions, such as:
Cannot remove ForeignKeyConstraint - remove the constraint first
when trying to remove a table.
Can anybody help??? 4 3439
Lucky enough is it as that is.
You can (normally I have seen a situation that does that) not have children
without a parent.
Therefore you have first to delete all the childs before you can delete the
parent.
If you want to do it than to the database (maybe that is your question),
than you have to use this. http://msdn2.microsoft.com/en-us/library/0f8054fy.aspx
First do the deleted children rows
Than the parent rows
Than the modified and added children.
Don't forget to do an acceptchanges on the original dataset.
You see than direct why is that acceptchanges.
I hope this helps,
Cor
"G .Net" <no********@email.comschreef in bericht
news:sP********************@pipex.net...
Hi
I have a DataSet with several DataTables. I have set up relations between
these tables.
I want to delete all the tables and re-fill them. However, when I try to
do so, even after using Relations.Clear() I still get excecptions, such
as:
Cannot remove ForeignKeyConstraint - remove the constraint first
when trying to remove a table.
Can anybody help???
Hi Cor
Thanks for that. I'll have a look.
However, I'm puzzled why clearning the relations doesn't solve it? Surely
that should make the tables seperate (i.e. with no relationships) so I can
simple do something like:
dt.Remove()
for any table. However, as I indicated earlier, this stil throws an
exception.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:uB**************@TK2MSFTNGP03.phx.gbl...
Lucky enough is it as that is.
You can (normally I have seen a situation that does that) not have
children without a parent.
Therefore you have first to delete all the childs before you can delete
the parent.
If you want to do it than to the database (maybe that is your question),
than you have to use this. http://msdn2.microsoft.com/en-us/library/0f8054fy.aspx
First do the deleted children rows
Than the parent rows
Than the modified and added children.
Don't forget to do an acceptchanges on the original dataset.
You see than direct why is that acceptchanges.
I hope this helps,
Cor
"G .Net" <no********@email.comschreef in bericht
news:sP********************@pipex.net...
>Hi
I have a DataSet with several DataTables. I have set up relations between these tables.
I want to delete all the tables and re-fill them. However, when I try to do so, even after using Relations.Clear() I still get excecptions, such as:
Cannot remove ForeignKeyConstraint - remove the constraint first
when trying to remove a table.
Can anybody help???
Did you figure out what the problem was? I'm running into the same
thing. I have a dataset with 2 tables in it. Clearing the relations
doesn't seem to do anything. Instead I can first clear the child
table, then clear the parent table. I can't remove the table from the
dataset however. I get the error 'Cannot remove table ... because it
is referenced in ForeignKeyConstraint ... Remove the constraint first.'
How can I remove the constraint? Clearing the relations doesn't do it.
Jesse.
G .Net wrote:
Hi Cor
Thanks for that. I'll have a look.
However, I'm puzzled why clearning the relations doesn't solve it? Surely
that should make the tables seperate (i.e. with no relationships) so I can
simple do something like:
dt.Remove()
for any table. However, as I indicated earlier, this stil throws an
exception.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:uB**************@TK2MSFTNGP03.phx.gbl...
Lucky enough is it as that is.
You can (normally I have seen a situation that does that) not have
children without a parent.
Therefore you have first to delete all the childs before you can delete
the parent.
If you want to do it than to the database (maybe that is your question),
than you have to use this. http://msdn2.microsoft.com/en-us/library/0f8054fy.aspx
First do the deleted children rows
Than the parent rows
Than the modified and added children.
Don't forget to do an acceptchanges on the original dataset.
You see than direct why is that acceptchanges.
I hope this helps,
Cor
"G .Net" <no********@email.comschreef in bericht
news:sP********************@pipex.net...
Hi
I have a DataSet with several DataTables. I have set up relations between
these tables.
I want to delete all the tables and re-fill them. However, when I try to
do so, even after using Relations.Clear() I still get excecptions, such
as:
Cannot remove ForeignKeyConstraint - remove the constraint first
when trying to remove a table.
Can anybody help???
Nevermind, I figured it out. I had to remove the primary key
constraint AND the foreign key constraint, THEN clear the relations,
THEN I could remove the table.
ds.Tables("dt1").Constraints.RemoveAt(0)
ds.Tables("dt2").Constraints.RemoveAt(0)
ds.Relations.Clear()
dsOTTR.Tables.Clear()
Jesse wrote:
Did you figure out what the problem was? I'm running into the same
thing. I have a dataset with 2 tables in it. Clearing the relations
doesn't seem to do anything. Instead I can first clear the child
table, then clear the parent table. I can't remove the table from the
dataset however. I get the error 'Cannot remove table ... because it
is referenced in ForeignKeyConstraint ... Remove the constraint first.'
How can I remove the constraint? Clearing the relations doesn't do it.
Jesse.
G .Net wrote:
Hi Cor
Thanks for that. I'll have a look.
However, I'm puzzled why clearning the relations doesn't solve it? Surely
that should make the tables seperate (i.e. with no relationships) so I can
simple do something like:
dt.Remove()
for any table. However, as I indicated earlier, this stil throws an
exception.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:uB**************@TK2MSFTNGP03.phx.gbl...
Lucky enough is it as that is.
>
You can (normally I have seen a situation that does that) not have
children without a parent.
>
Therefore you have first to delete all the childs before you can delete
the parent.
>
If you want to do it than to the database (maybe that is your question),
than you have to use this. http://msdn2.microsoft.com/en-us/library/0f8054fy.aspx
>
First do the deleted children rows
Than the parent rows
Than the modified and added children.
>
Don't forget to do an acceptchanges on the original dataset.
>
You see than direct why is that acceptchanges.
>
I hope this helps,
>
Cor
>
"G .Net" <no********@email.comschreef in bericht
news:sP********************@pipex.net...
>Hi
>>
>I have a DataSet with several DataTables. I have set up relations between
>these tables.
>>
>I want to delete all the tables and re-fill them. However, when I try to
>do so, even after using Relations.Clear() I still get excecptions, such
>as:
>>
>Cannot remove ForeignKeyConstraint - remove the constraint first
>>
>when trying to remove a table.
>>
>Can anybody help???
>>
>>
>>
>
>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: toedipper |
last post by:
Hello,
I am designing a table of vehicle types, nothing special, just a list of
unique vehicle types such as truck, lorry, bike, motor bike, plane, tractor
etc etc
For the table design I am...
|
by: harish |
last post by:
DELETING 100 million from a table weekly SQl SERVER 2000
Hi All
We have a table in SQL SERVER 2000 which has about 250 million records
and this will be growing by 100 million every week. At a...
|
by: Scott Ribe |
last post by:
I've got a problem which I think may be a bug in Postgres, but I wonder if
I'm missing something. Two tables, A & B have foreign key relations to each
other. A 3rd table C, inherits from A. A...
|
by: Dr NoName |
last post by:
Help!
I have a table that multiple processes must be able to
write to concurrently. However, it for some reason
gets locked in exclusive mode. I narrowed it down to
one SQL statement + some...
|
by: maricel |
last post by:
I have the following base table structure - DDL:
CREATE TABLE "ADMINISTRATOR"."T1" (
"C1" INTEGER NOT NULL )
IN "TEST_TS" ;
ALTER TABLE "ADMINISTRATOR"."T1"
ADD PRIMARY KEY
|
by: G .Net |
last post by:
Hi
I'm hoping that somebody can help me with a fairly puzzling problem.
I've created some DataTables which have relations between them e.g. one to
many. In the application, I want to remove...
|
by: markjerz |
last post by:
Hi,
I basically have two tables with the same structure. One is an archive
of the other (backup). I want to essentially insert the data in to the
other.
I use:
INSERT INTO table ( column,...
|
by: JHNielson |
last post by:
I am not new to Access, but am new to the level of complexity I am now having to get into, so this question may be easy, but I don't even know what to look for to see if it has been posted here...
|
by: yeoj13 |
last post by:
Hello,
I have a db2load script I'm using to populate a large table.
Ideally, my target table is required to have "Not Null" constraints on
a number of different columns.
I've noticed a ...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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: 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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |