469,602 Members | 1,537 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

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
Jul 18 '06 #1
2 4347
Doesn't the update method of a data adapter return the number of rows
affected?
Dim count as integer = myDataAdapter.Update(myDataTable)

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
Jul 18 '06 #2
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.Update 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.Update 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.Update(myDataTable)

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

Jul 19 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Rich Protzel | last post: by
1 post views Thread by Galen Harris | last post: by
reply views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.