473,414 Members | 1,989 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,414 software developers and data experts.

return # of rows updated

Claus Mygind
571 512MB
Is it possible to find out how many rows are updated when something like the following code is executed?

Expand|Select|Wrap|Line Numbers
  1. update pSum set hours = 8.0 where empno = 623 and detcode = 'Reg'
May 7 '09 #1
2 1803
mwasif
802 Expert 512MB
You can use MySQL C API function mysql_affected_rows().
May 7 '09 #2
Claus Mygind
571 512MB
@mwasif
I tried running the example in the MySQL Query Browser but it would not execute

Here is the example your link point to

Expand|Select|Wrap|Line Numbers
  1. char *stmt = "UPDATE products SET cost=cost*1.25 WHERE group=10";
  2. mysql_query(&mysql,stmt);
  3. printf("%ld products updated",
  4.        (long) mysql_affected_rows(&mysql));
  5.  
Of course I used my own data for the update command.
May 7 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Chris Stromberger | last post by:
When issuing updates in mysql (in the console window), mysql will tell you if any rows matched and how many rows were updated (see below). I know how to get number of rows udpated using MySQLdb,...
6
by: PG | last post by:
When deleting a row from the database, that id is now missing. So what I'm trying to do is update in a loop (maybe an sql loop if there is one) of all of the id numbers - sort of like renaming...
13
by: EmbersFire | last post by:
I'm using a stored proceedure which should update a number of rows in a table depending on a key value supplied (in this case 'JobID'). But what's happening is when I call the proc from within the...
1
by: annie | last post by:
Hi all, I have recently ported my Access 2000 app to SQL Server, keeping the Access client as the front end using linked tables. I am also using triggers on my SQL tables to trap orphan...
7
by: Khan | last post by:
Hi, I'm using table it has 100 rows, how can i update 10 or 15 rows at the same time with single query. In real case, if user enters "5" in textbox it means that the "5" rows will be updated. ...
4
by: Miesha.James | last post by:
Hello. Is there a way you can insert a new row between current rows in a .NET listview? I tried and it was no success. The reason I want to do this is because when the application starts up it...
0
by: rhepsi | last post by:
hii.. i have arequirement where... i want to update a field to N for the rows that are present in the datagrid... 1) strSQL = "UPDATE tbl_worker_profile SET " & _ ...
4
by: mcl | last post by:
I have looked through Python Database API Specification v2.0, but can not find any reference to the number of records processed in a select query. I know I can get the number of records returned...
0
by: roseate4amor | last post by:
dear all, i have a problem that i try to fix since the last few weeks. i need to add a new data in microsoft office database using dataset in visual basic. the problem is, when i insert new data...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...

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.