获取有关的ExecuteNonQuery受影响的行 [英] Get affected rows on ExecuteNonQuery

查看:169
本文介绍了获取有关的ExecuteNonQuery受影响的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前工作的一个C#项目,我运行一个插入查询,它也做一个选择在同一时间,例如:

I am currently working on a C# project and I am running an insert query which also does a select at the same time, e.g.:

INSERT INTO table (SELECT * FROM table WHERE column=date)

有没有一种方法,我可以看到有多少行此查询过程中插入?

Is there a way I can see how many rows were inserted during this query?

推荐答案

的ExecuteNonQuery - 返回的行数受影响

ExecuteNonQuery - returns the number of rows affected.

SqlCommand comm;
// other codes
int numberOfRecords = comm.ExecuteNonQuery();

这篇关于获取有关的ExecuteNonQuery受影响的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆