473,769 Members | 2,106 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

capture records Affected count from dataAdapter.Upd ate(...?

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

Jul 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
11559
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 records affected like from Query
2
4270
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 underline. It was working fine before. ConnectionString in Web.config: ----------------------------------------- <?xml version="1.0" encoding="utf-8" ?> <configuration>
1
1384
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 save the changes. Problem is, the original adapter is long gone. It seems like cloogy to recreate the exact adapter again, fill another dataset, and then replace that dataset with the one in session in order to update our records. That can't...
1
2315
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 - Date/Time TimeOpened - Date/Time
2
2123
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 btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click DA.Update(DataSet, "mytable") End Sub
4
11168
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 call the following method. public void JobListDataTableFromAccessCommitChange() { System.Data.DataTable oChangeDataTable;
7
2867
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 Sub cmdTest_Click() Dim db As Database Dim Test1, Count1 As String Set db = CurrentDb() Test1 = "UPDATE TestTable SET TestTable.TestField = '1'" & _
2
2897
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 following exception: Incorrect syntax near ','. Must declare scalar variable "@ContactID". Here's the code: private void btnSave_Click (object sender, EventArgs e) { DataRow row = dataTable.Rows ; ...
2
3881
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 stated. Also please note that this is unrelated to another of my previous threads, “dataAdapter.Update problem”, which incidentally has been resolved. I’m learning SQL. I’m accessing database SQL2008 AdventureWorks, table Person.Contact, which has a...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10049
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8873
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.