-----Mensagem original-----
Hi Mauricio,
Thanks for your reply,
You may try this way:
1.In your dataset schema, set the delete rule of your parent-child relation
to cascade.
then you can delete the parent without problem in the dataset, the
corresponding child rows will be removed automatically.
2.To persist changes to your database, you may use the Update method on
each dataAdapters.
You should first update your child table, then update your parent table. Or
you will break the foreignkey constraint in DB.
Does this solve your problem?
If you still have problem on it, please be free to post it this group.
Thanks!
Best regards,
Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!
--------------------
| Content-Class: urn:content-classes:message
| From: "Mauricio" <
[email protected]>
| Sender: "Mauricio" <
[email protected]>
| References: <
[email protected]>
<
[email protected]>
| Subject: RE: Howto handle InvalidConstrainException with DataGrid
| Date: Wed, 29 Oct 2003 02:06:23 -0800
| Lines: 78
| Message-ID: <
[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcOeBE79TAZijM3yRWqbye+JxF+P7Q==
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:55422
| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| Hi Ying-Shen Yu,
| I know that I need delete all child rows, but how can I
| delete them before datagrid delete the parent row?
| Is There an event thrown by the datagrid before delete the
| parent row?
| Thanks,
| Best regards,
| Mauricio
|
| >-----Mensagem original-----
| >Hi Mauricio,
| >If the parent row is related to one or more child rows,
| deleting this
| >parent row will
| >violates the ForeignKeyConstraint, you need delete all
| the child rows
| >before
| >deleting the parent row.
| >Does this solve your problem?
| >If you still have problem on this issue, please be free
| to post on this
| >group,
| >Thanks!
| >
| >Best regards,
| >
| >Ying-Shen Yu [MSFT]
| >Microsoft Online Partner Support
| >Get Secure! -
www.microsoft.com/security
| >
| >This posting is provided "AS IS" with no warranties and
| confers no rights.
| >You should not reply this mail directly, "Online" should
| be removed before
| >sending, Thanks!
| >
| >--------------------
| >| Content-Class: urn:content-classes:message
| >| From: =?iso-8859-1?Q?Maur=EDcio?=
| <
[email protected]>
| >| Sender: =?iso-8859-1?Q?Maur=EDcio?=
| <
[email protected]>
| >| Subject: Howto handle InvalidConstrainException with
| DataGrid
| >| Date: Tue, 28 Oct 2003 11:57:31 -0800
| >| Lines: 10
| >| Message-ID: <
[email protected]>
| >| MIME-Version: 1.0
| >| Content-Type: text/plain;
| >| charset="iso-8859-1"
| >| Content-Transfer-Encoding: 7bit
| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| >| Thread-Index: AcOdjbku+AUz5DnhSCuqmKT3EkYQPg==
| >| Newsgroups:
| microsoft.public.dotnet.framework.windowsforms
| >| Path: cpmsftngxa06.phx.gbl
| >| Xref: cpmsftngxa06.phx.gbl
| >microsoft.public.dotnet.framework.windowsforms:55388
| >| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
| >| X-Tomcat-NG:
| microsoft.public.dotnet.framework.windowsforms
| >|
| >| On my form there are 2 DataGrids bind with a DataSet.
| One
| >| is the parent and the other is the child.
| >| When I delete a parent row it's thrown a
| >| InvalidCostrainException exception.
| >| How can I handle this exception? I don't know how to
| >| define the method that will handle it.
| >|
| >|
| >|
| >|
| >|
| >
| >.
| >
|
.