Question about SqlDataAdapter.RowUpdating Event

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Programatix

    Question about SqlDataAdapter.RowUpdating Event

    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.Chi ldRelations
    Dim rows As DataRow()

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

    If you try this code, e.Row.GetChildR ows(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.


  • Armin Zingler

    #2
    Re: Question about SqlDataAdapter. RowUpdating Event

    "Programati x" <programatix@no spam.com> schrieb[color=blue]
    > Newsgroups:[/color]
    microsoft.publi c.dotnet.framew ork,microsoft.p ublic.dotnet.fr amework.adonet, m
    icrosoft.public .dotnet.framewo rk.webservices, microsoft.publi c.dotnet.genera l
    ,microsoft.publ ic.dotnet.langu ages.vb


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

    Armin

    Comment

    • Programatix

      #3
      Re: Question about SqlDataAdapter. RowUpdating Event

      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(DataTabl e) 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.

      "Programati x" <programatix@no spam.com> wrote in message
      news:eKGJ45QTDH A.2276@TK2MSFTN GP10.phx.gbl...[color=blue]
      > Hi,
      >
      > I'm working on a WebService project. I'm trying to validate data before[/color]
      they[color=blue]
      > 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.Chi ldRelations
      > Dim rows As DataRow()
      >
      > ' e.Row.GetChildR ows(relation) will always return nothing
      > rows = e.Row.GetChildR ows(relation)
      > Next
      >
      > If you try this code, e.Row.GetChildR ows(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.
      >
      >[/color]


      Comment

      • Programatix

        #4
        Re: Question about SqlDataAdapter. RowUpdating Event

        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.

        "Armin Zingler" <az.nospam@free net.de> wrote in message
        news:u4NDFURTDH A.3116@TK2MSFTN GP10.phx.gbl...[color=blue]
        > "Programati x" <programatix@no spam.com> schrieb[color=green]
        > > Newsgroups:[/color]
        >[/color]
        microsoft.publi c.dotnet.framew ork,microsoft.p ublic.dotnet.fr amework.adonet, m[color=blue]
        >[/color]
        icrosoft.public .dotnet.framewo rk.webservices, microsoft.publi c.dotnet.genera l[color=blue]
        > ,microsoft.publ ic.dotnet.langu ages.vb
        >
        >
        > Whenever making crossposts, please use *only* the appropriate groups. This
        > is not related to VB.Net.
        >
        > Armin
        >[/color]


        Comment

        • Programatix

          #5
          Re: Question about SqlDataAdapter. RowUpdating Event

          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.

          :)

          "Armin Zingler" <az.nospam@free net.de> wrote in message
          news:OzsCtJVTDH A.1020@TK2MSFTN GP11.phx.gbl...[color=blue]
          > "Programati x" <programatix@no spam.com> schrieb[color=green]
          > > 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.[/color]
          >
          > Would it be the same question in C#? If yes, it's not related to VB. As[/color]
          the[color=blue]
          > subject (and the question) shows, it's a about ADO.Net and the Framework
          > class library, no matter which language you use. So it's not a VB.Net
          > related question, IMHO.
          >
          > Armin
          >[/color]


          Comment

          • Armin Zingler

            #6
            Re: Question about SqlDataAdapter. RowUpdating Event

            "Programati x" <programatix@no spam.com> schrieb[color=blue]
            > 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.
            >
            > :)[/color]

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

            Armin

            Comment

            • Kathleen Dollard

              #7
              Re: Question about SqlDataAdapter. RowUpdating Event

              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).

              --
              Kathleen (MVP-VB)



              "Programati x" <programatix@no spam.com> wrote in message
              news:ej7bc0YTDH A.2276@TK2MSFTN GP10.phx.gbl...[color=blue]
              > Still sometime, anyone with VB skill could have known the solution and[/color]
              that[color=blue]
              > someone, since always used VB only browse the VB newsgroup, might not[/color]
              browse[color=blue]
              > the ADO .Net newsgroup. And in this case, that someone might not know that
              > his/her help is needed.
              >
              > :)
              >
              > "Armin Zingler" <az.nospam@free net.de> wrote in message
              > news:OzsCtJVTDH A.1020@TK2MSFTN GP11.phx.gbl...[color=green]
              > > "Programati x" <programatix@no spam.com> schrieb[color=darkred]
              > > > 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.[/color]
              > >
              > > Would it be the same question in C#? If yes, it's not related to VB. As[/color]
              > the[color=green]
              > > subject (and the question) shows, it's a about ADO.Net and the Framework
              > > class library, no matter which language you use. So it's not a VB.Net
              > > related question, IMHO.
              > >
              > > Armin
              > >[/color]
              >
              >[/color]


              Comment

              • Programatix

                #8
                Re: Question about SqlDataAdapter. RowUpdating Event

                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.

                "Kathleen Dollard" <kathleen@mvps. org> wrote in message
                news:%23bb1wQfT DHA.2824@tk2msf tngp13.phx.gbl. ..[color=blue]
                > 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[/color]
                helps[color=blue]
                > you get the answer your looking for (except when the issue lies on teh[/color]
                seam[color=blue]
                > between multiple groups).
                >
                > --
                > Kathleen (MVP-VB)
                >
                >
                >
                > "Programati x" <programatix@no spam.com> wrote in message
                > news:ej7bc0YTDH A.2276@TK2MSFTN GP10.phx.gbl...[color=green]
                > > Still sometime, anyone with VB skill could have known the solution and[/color]
                > that[color=green]
                > > someone, since always used VB only browse the VB newsgroup, might not[/color]
                > browse[color=green]
                > > the ADO .Net newsgroup. And in this case, that someone might not know[/color][/color]
                that[color=blue][color=green]
                > > his/her help is needed.
                > >
                > > :)
                > >
                > > "Armin Zingler" <az.nospam@free net.de> wrote in message
                > > news:OzsCtJVTDH A.1020@TK2MSFTN GP11.phx.gbl...[color=darkred]
                > > > "Programati x" <programatix@no spam.com> schrieb
                > > > > 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.
                > > >
                > > > Would it be the same question in C#? If yes, it's not related to VB.[/color][/color][/color]
                As[color=blue][color=green]
                > > the[color=darkred]
                > > > subject (and the question) shows, it's a about ADO.Net and the[/color][/color][/color]
                Framework[color=blue][color=green][color=darkred]
                > > > class library, no matter which language you use. So it's not a VB.Net
                > > > related question, IMHO.
                > > >
                > > > Armin
                > > >[/color]
                > >
                > >[/color]
                >
                >[/color]


                Comment

                Working...