Rowchanging exception don't propagate (ado.net 2)
- From: francesco.fantoni@xxxxxxxxx
- Date: 3 Apr 2007 06:29:08 -0700
if i throw an exception in datatable rowchanging (using strongly typed
dataset) this exception don't propagate in debug mode (at runtime it
seems work instead)
in details, im using vs2005 with sqlserver 2005 express and i have a
strongly typed dataset with customer datatable and a form with
bindingnavigator. In CustomersBindingSaveitem_Click event :
Try
Me.Validate()
Me.CustomersBindingSource.EndEdit()
Me.CustomersTableAdapter.Update(Me.DataSet.Clienti)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information,
My.Application.Info.Title)
End Try
RowChanging handler is this:
Private Sub CustomersDataTable_CustomersRowChanging(ByVal sender As
System.Object, ByVal e As ClientiRowChangeEvent) Handles
Me.CustomersRowChanging
If .... Then
e.Row.SetColumnError("customer", "customer is
invalid")
e.Row.RowError = "customer is invalid"
Throw New ArgumentException(e.Row.RowError)
Else
e.Row.SetColumnError("customer", ", "")
e.Row.ClearErrors()
End If
End Sub
i need to cancel row updating and according with msdn i have to throw
an exception in Rowchanging event.
I have found this passed issue:
http://groups.google.it/group/microsoft.public.dotnet.framework.adonet/browse_thread/thread/8c4a1f751694d971/4d8baec0dfe6636e?lnk=st&q=rowchanging+exception&rnum=16&hl=it#4d8baec0dfe6636e
it's a bug also in ado.net version 2.0?
Thanks,
- Francesco
.
- Follow-Ups:
- Re: Rowchanging exception don't propagate (ado.net 2)
- From: Francesco Fantoni
- Re: Rowchanging exception don't propagate (ado.net 2)
- Prev by Date: Re: Post Revised: A Desperate Plea for Help
- Next by Date: Re: Tabledefs and VB.net
- Previous by thread: Re: VS 2005 MS SQL server express query problem
- Next by thread: Re: Rowchanging exception don't propagate (ado.net 2)
- Index(es):
Relevant Pages
|
Loading