Determine rows affected by Update command

Determine rows affected by Update command

Postby dghundt » Fri 02 May 2008 00:43

I use this snippet to update row(s) in the database, but need to know the number of rows affected. What is the easiest way to get the number of rows affected? Thanks!

Code: Select all
                                   
string myInsertCommand = "UPDATE callees " +
"SET result = '" + result + "' " +
"WHERE (customer.id = " + id + ") AND (status <> 'BUSY')";
                                   
PgSqlCommand insertData = new PgSqlCommand(myInsertCommand, pgSqlConnection1);
pgSqlConnection1.Open();
insertData.ExecuteNonQuery();
dghundt
 
Posts: 38
Joined: Thu 24 Aug 2006 01:16

Postby Alexey.mdr » Mon 05 May 2008 13:30

You can use the following line:
Code: Select all
int recordsAffected = insertData.ExecuteNonQuery();
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Postby dghundt » Mon 05 May 2008 19:46

Thank you.
dghundt
 
Posts: 38
Joined: Thu 24 Aug 2006 01:16

Postby Alexey.mdr » Tue 06 May 2008 11:41

No problem.
Feel free to contact us if you have any further questions or concerns about the product.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24


Return to dotConnect for PostgreSQL