473,395 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 4535
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Rich Protzel | last post by:
Hello, If I run an action SP from MS Access using ADO: ... cmd.execute where the SP is something like Create... Update tbl1 set fld1 = 'something' where... how can I retrive the count of...
2
by: hch | last post by:
dataAdapter.Update(data, "TableName") won’t work! I was about to deploy my first website on the Internet only to discover that the dataAdapter.Update() throws the Server Error in the third...
1
by: Galen Harris | last post by:
What's the best practice to use the dataadapter.update on a dataset that's been stored in session? We create a dataset on one page, and later in site, we want to call the dataadapter.update() to...
1
by: mivey4 | last post by:
Okay, The problem is that I have an Access Database that has the following fields: EmpID - Autonumber (PrimaryKey) AccountID - Text IssueReported - Memo DateOpened ...
2
by: johnb41 | last post by:
I have a very simple application where i just want to display records from a database, and be able to edit the records. Here's the code for the "update" button: Private Sub...
4
by: George | last post by:
Got a question about the side effect of DataAdapter.Update() and DataTable.GetChanges(). Say I set up a DataTable and a DataAdapter in a class. Delete (Not remove) a row in the data table and...
7
by: Lewe22 | last post by:
I am performing a series of updates from a command button on an access form. I want to record the number of records affected for each update transaction. I have simplified some code.. Private...
2
by: BobLewiston | last post by:
I can read in an SQL table ("Person.Contact") from AdventureWorks and step through it one row at a time, but when I try to save a record, either one I'm inserting or one I'm editting, I get the...
2
by: BobLewiston | last post by:
Some of you may have seen my earlier thread “PasswordHash NULL problem”. I’ve started a new thread because investigation has shown that the problem is actually quite different than I previously...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.