capture records Affected count from dataAdapter.Update(...?

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

    #1

    capture records Affected count from dataAdapter.Update(...?

    Hello,

    Is there a way to capture the Records Affected count when performing a table
    Update on a Sql Server table using a DataAdapter? How is this done?

    Thanks,
    Rich
  • Steven Nagy

    #2
    Re: capture records Affected count from dataAdapter.Upd ate(...?

    Doesn't the update method of a data adapter return the number of rows
    affected?
    Dim count as integer = myDataAdapter.U pdate(myDataTab le)

    You can find out BEFORE the update call by checking your
    dataset/datatable and getting all rows with 'GetChanges' which returns
    an array of datarows that will be updated. Naturally just get the
    Length property of this returned array to get the count.

    MSDN documentation covers all of this, naturally.

    Rich wrote:
    Hello,
    >
    Is there a way to capture the Records Affected count when performing a table
    Update on a Sql Server table using a DataAdapter? How is this done?
    >
    Thanks,
    Rich

    Comment

    • Rich

      #3
      Re: capture records Affected count from dataAdapter.Upd ate(...?

      Thanks for replying to my post. I am not in the office right now, so can't
      try out your suggestion. But it seems simple enough.

      As for 'GetChanges', my goal is more to see a count of rows in the table on
      the sql server that were affected. Like 3 rows were updated. I am guessing
      that I could check 'GetChanges' on the datatable in my app before I perform
      the dataAdapter.Upd ate thing. But I am actually interested in the table in
      the sql server.

      Thanks again for showing me how to retrieve the count of RowsAffected for
      the DataAdapter.Upd ate method.

      Rich


      "Steven Nagy" wrote:
      Doesn't the update method of a data adapter return the number of rows
      affected?
      Dim count as integer = myDataAdapter.U pdate(myDataTab le)
      >
      You can find out BEFORE the update call by checking your
      dataset/datatable and getting all rows with 'GetChanges' which returns
      an array of datarows that will be updated. Naturally just get the
      Length property of this returned array to get the count.
      >
      MSDN documentation covers all of this, naturally.
      >
      Rich wrote:
      Hello,

      Is there a way to capture the Records Affected count when performing a table
      Update on a Sql Server table using a DataAdapter? How is this done?

      Thanks,
      Rich
      >
      >

      Comment

      Working...