Question about SqlDataAdapter.RowUpdating Event

  • Thread starter Thread starter Programatix
  • Start date Start date
P

Programatix

Hi,

I'm working on a WebService project. I'm trying to validate data before they
are updated to the database by handling the RowUpdating event for a
SqlDataAdapter.

The data being handled has DataRelation which is related to another
DataTable. As for that, I also need to retrieve the DataRelation from the
current row being updated. I wrote a code which look something like this,
Dim relation As DataRelation
For Each relation In e.Row.Table.ChildRelations
Dim rows As DataRow()

' e.Row.GetChildRows(relation) will always return nothing
rows = e.Row.GetChildRows(relation)
Next

If you try this code, e.Row.GetChildRows(relation) will always return
nothing even though the DataTable which contains the DataRow has
DataRelation.

Beside that, the e.Row.HasErrors and e.Row.RowError properties will also
return nothing.

Is this a bug in .NET Framework 1.1 or I need to change the coding.

Thanks.
 
Programatix said:
Newsgroups:
microsoft.public.dotnet.framework,microsoft.public.dotnet.framework.adonet,m
icrosoft.public.dotnet.framework.webservices,microsoft.public.dotnet.general
,microsoft.public.dotnet.languages.vb


Whenever making crossposts, please use *only* the appropriate groups. This
is not related to VB.Net.

Armin
 
I've finally found where the problem lies. It's my fault actually. When I
asked the SqlDataAdapter to update to database, I used the following
overloaded Update method,
Overloads Public Function Update(DataTable) As Integer

Because of this, the information included in the DataSet is not included in
the RowUpdating event.

The original idea to use DataTable instead of DataSet is because in my
opinion, sending the DataTable will be faster than DataSet, but it seems to
produce more problem than I have ever thought of.

Sigh...

Thanks for reading.
 
Why is it not related to VB .Net? I'm using VB .Net to write the code. As
for that, it should be related to VB .Net.
 
Still sometime, anyone with VB skill could have known the solution and that
someone, since always used VB only browse the VB newsgroup, might not browse
the ADO .Net newsgroup. And in this case, that someone might not know that
his/her help is needed.

:)
 
Programatix said:
Still sometime, anyone with VB skill could have known the solution
and that someone, since always used VB only browse the VB newsgroup,
might not browse the ADO .Net newsgroup. And in this case, that
someone might not know that his/her help is needed.

:)

Then you should also post to alt.binaries.cartoons.french because there
might be someone who can help you. ;-)

Armin
 
Depends on whether you want a good answer, or any answer.

I actually skimmed by this yesterday because I was in a rush and saw that
Armin had answered you.

Good that you answered your question, but I think crossposting rarely helps
you get the answer your looking for (except when the issue lies on teh seam
between multiple groups).
 
In my case now, I want any answer.

Anyway, enough is enough. There is no need for arguement here. Armin has his
point but sometime, that someone needed a quick respond and any responds are
considered good, even though it's not.
 
Back
Top