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 entries from the table. To do
this I obviously need to temporarily switch off the relations. In order to
achieve this, I tried:
ds.Relations.Clear() ' where ds is the application DataSet
ds.Tables("table1").Clear()
but I get the exception:
"An unhandled exception of type 'System.ArgumentException' occurred in
system.data.dll
Additional information: Cannot remove unique constraint 'Constraint1'.
Remove foreign key constraint table1_table3' first."
What I don't understand is why the relations don't seem to have been
removed.
Can anybody point me in the right direction i.e. how do I switch off the
relations to allow the clearing of a table?
Many thanks in advance
Geoff 5 3081
The exception is telling you to remove your indexes first - there is a
foreign key index from the child table to the parent. Remove that
first, then remove the relation.
T
G .Net wrote:
>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 entries from the table. To do this I obviously need to temporarily switch off the relations. In order to achieve this, I tried:
ds.Relations.Clear() ' where ds is the application DataSet ds.Tables("table1").Clear()
but I get the exception:
"An unhandled exception of type 'System.ArgumentException' occurred in system.data.dll Additional information: Cannot remove unique constraint 'Constraint1'. Remove foreign key constraint table1_table3' first."
What I don't understand is why the relations don't seem to have been removed.
Can anybody point me in the right direction i.e. how do I switch off the relations to allow the clearing of a table?
Many thanks in advance
Geoff
Hello G .Net,
Goofball. The relationships are there for a reason. They define how you
are to interact with the data. Follow their rules.
-Boo
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 entries from the
table. To do this I obviously need to temporarily switch off the
relations. In order to achieve this, I tried:
ds.Relations.Clear() ' where ds is the application DataSet
ds.Tables("table1").Clear()
but I get the exception:
"An unhandled exception of type 'System.ArgumentException' occurred in
system.data.dll
Additional information: Cannot remove unique constraint 'Constraint1'.
Remove foreign key constraint table1_table3' first."
What I don't understand is why the relations don't seem to have been
removed.
Can anybody point me in the right direction i.e. how do I switch off
the relations to allow the clearing of a table?
Many thanks in advance
Geoff
Err, yes I know they're there for a reason ;) but I have my reasons for
doing this!
Geoff
"GhostInAK" <gh*******@gmail.comwrote in message
news:c7**************************@news.microsoft.c om...
Hello G .Net,
Goofball. The relationships are there for a reason. They define how you
are to interact with the data. Follow their rules.
-Boo
>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 entries from the table. To do this I obviously need to temporarily switch off the relations. In order to achieve this, I tried:
ds.Relations.Clear() ' where ds is the application DataSet ds.Tables("table1").Clear()
but I get the exception:
"An unhandled exception of type 'System.ArgumentException' occurred in system.data.dll Additional information: Cannot remove unique constraint 'Constraint1'. Remove foreign key constraint table1_table3' first." What I don't understand is why the relations don't seem to have been removed.
Can anybody point me in the right direction i.e. how do I switch off the relations to allow the clearing of a table?
Many thanks in advance
Geoff
Hi T
Could you tell me how to remove the indexes?
Geoff
"tomb" <to**@technetcenter.comwrote in message
news:oO*****************@bignews4.bellsouth.net...
The exception is telling you to remove your indexes first - there is a
foreign key index from the child table to the parent. Remove that first,
then remove the relation.
T
G .Net wrote:
>>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 entries from the table. To do this I obviously need to temporarily switch off the relations. In order to achieve this, I tried:
ds.Relations.Clear() ' where ds is the application DataSet ds.Tables("table1").Clear()
but I get the exception:
"An unhandled exception of type 'System.ArgumentException' occurred in system.data.dll Additional information: Cannot remove unique constraint 'Constraint1'. Remove foreign key constraint table1_table3' first."
What I don't understand is why the relations don't seem to have been removed.
Can anybody point me in the right direction i.e. how do I switch off the relations to allow the clearing of a table?
Many thanks in advance
Geoff
Basically, I need to know how to remove Unique and ForeignKey constraints.
The following line of code does not work:
ds.Tables("Table1").Constraints.Clear()
Thanks in advance
Geoff
"G .Net" <no********@email.comwrote in message
news:hp******************************@pipex.net...
Hi T
Could you tell me how to remove the indexes?
Geoff
"tomb" <to**@technetcenter.comwrote in message
news:oO*****************@bignews4.bellsouth.net...
>The exception is telling you to remove your indexes first - there is a foreign key index from the child table to the parent. Remove that first, then remove the relation.
T
G .Net wrote:
>>>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 entries from the table. To do this I obviously need to temporarily switch off the relations. In order to achieve this, I tried:
ds.Relations.Clear() ' where ds is the application DataSet ds.Tables("table1").Clear()
but I get the exception:
"An unhandled exception of type 'System.ArgumentException' occurred in system.data.dll Additional information: Cannot remove unique constraint 'Constraint1'. Remove foreign key constraint table1_table3' first."
What I don't understand is why the relations don't seem to have been removed.
Can anybody point me in the right direction i.e. how do I switch off the relations to allow the clearing of a table?
Many thanks in advance
Geoff
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Andreas Fromm |
last post by:
Hi,
I have The following situation:
CREATE TABLE data1 (
id SERIAL PRIMARY KEY,
data INTEGER
);
CREATE TABLE data2 (
|
by: Matthew Wells |
last post by:
I'm using this code to delete all relationships in my mdb file
iFlag = 1
Do While iFlag <> 0
iFlag = 0
For Each rel In db.Relations
db.Relations.Delete rel.Name
iFlag = 1
Next rel
Loop
|
by: Jef De Rycke |
last post by:
Hi access group,
I have written code to create relations between tables according to a
corresponding relations information table.
At first I thought my code was not working properly because...
|
by: Randy Fraser |
last post by:
How do I create a relationship on muliple columns in an untyped dataset.
Why does this not work.
da.Fill(ds)
ds.Tables(0).TableName = "DesignSummary"
ds.Tables(1).TableName = "FormulaSummary"...
|
by: Joe |
last post by:
Hi
I have a dataset with 3 tables and 2 relations
Is there a way to when I am at 1 row to tell if there is a relation on that
row ???
I have the code hardcoded but try to make it work if the #...
|
by: Joe |
last post by:
Hi
I am going to receive a dataset downstream and I will not know the
the fields
number of field
relations
number of relations
So I have to be flexible to take unknown data and be able to...
|
by: G .Net |
last post by:
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...
|
by: Nick 'The database Guy' |
last post by:
Hello People,
Does anyone know how to browse and delete folders in VBA?
Thanks,
Nick McMillen
|
by: shriil |
last post by:
Hi
I have this database that calculates and stores the incentive amount
earned by employees of a particular department. Each record is
entered
by entering the Date, Shift (morn, eve, or night)...
|
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: 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: 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: 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...
|
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: 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...
| |