Verify Database Update

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

    #1

    Verify Database Update

    Hi, I asked this question last week, but still need some help.

    When I do an update to a database record (SQL Server), how would I do
    the code to verify that the update event has happened? I can't use
    transactions or stored procs in SQL Server. Is there a way to use vb in
    the asp.net sub procedure that would do this?

    Thanks.

    Kathy

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • CT

    #2
    Re: Verify Database Update

    Would the RowUpdated event of the DataAdapter class be of any help to you?

    --
    Carsten Thomsen
    Enterprise Development with Visual Studio .NET, UML, and MSF

    "Kathy Burke" <kathyburke40@a ttbi.com> wrote in message
    news:%23ps53i8V DHA.1832@TK2MSF TNGP09.phx.gbl. ..[color=blue]
    > Hi, I asked this question last week, but still need some help.
    >
    > When I do an update to a database record (SQL Server), how would I do
    > the code to verify that the update event has happened? I can't use
    > transactions or stored procs in SQL Server. Is there a way to use vb in
    > the asp.net sub procedure that would do this?
    >
    > Thanks.
    >
    > Kathy
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it![/color]


    Comment

    • Kathy Burke

      #3
      Re: Verify Database Update

      Since I'm only updating one record, it sounds good!

      I've never used it, could you possibly shoot me a code example of how to
      use it?

      Thanks!

      Kathy

      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      • Mark

        #4
        Re: Verify Database Update

        If you use an instance of the SqlCommand class with the ExecuteNonQuery
        method, it will return the number of rows affected by the SQL or Stored Proc
        that executed. That would be good enough for me ... I suppose you could
        also simultaneously update a modified_dt column with the current time, and
        then confirm that the record now has the updated time, rather than the old
        time.

        Hope this helps.

        Mark


        "Kathy Burke" <kathyburke40@a ttbi.com> wrote in message
        news:%23ps53i8V DHA.1832@TK2MSF TNGP09.phx.gbl. ..[color=blue]
        > Hi, I asked this question last week, but still need some help.
        >
        > When I do an update to a database record (SQL Server), how would I do
        > the code to verify that the update event has happened? I can't use
        > transactions or stored procs in SQL Server. Is there a way to use vb in
        > the asp.net sub procedure that would do this?
        >
        > Thanks.
        >
        > Kathy
        >
        > *** Sent via Developersdex http://www.developersdex.com ***
        > Don't just participate in USENET...get rewarded for it![/color]


        Comment

        • CT

          #5
          Re: Verify Database Update

          Kathy,

          Well, here's a short VB example of how to set it up:

          Protected Shared Sub OnRowUpdated(By Val sender As Object, ByVal e As
          SqlRowUpdatedEv entArgs)
          ' In this procedure you can perform checks of what happened, i.e.
          ' did the updated work and if not, what went wrong.
          ' Check the properties of the passed instance of
          ' SqlRowUpdatedEv entArgs (e). Please see the docs for
          ' more information.
          End Sub

          ......
          Dim MyDataAdapter As New SqlDataAdapter( ...)

          ' Set up event handler
          AddHandler MyDataAdapter.R owUpdated AdressOf OnRowUpdated

          ......

          Now, the RowUpdated (after) event is commonly used in connection with the
          RowUpdating event (before), so do have a look at both in the docs. I hope
          this gets you going.

          --
          Carsten Thomsen
          Enterprise Development with Visual Studio .NET, UML, and MSF

          "Kathy Burke" <kathyburke40@a ttbi.com> wrote in message
          news:%23Y54pz8V DHA.2352@TK2MSF TNGP12.phx.gbl. ..[color=blue]
          > Since I'm only updating one record, it sounds good!
          >
          > I've never used it, could you possibly shoot me a code example of how to
          > use it?
          >
          > Thanks!
          >
          > Kathy
          >
          > *** Sent via Developersdex http://www.developersdex.com ***
          > Don't just participate in USENET...get rewarded for it![/color]


          Comment

          Working...