sql查询数据库时返回的影响行数

来源:百度知道 编辑:UC知道 时间:2024/06/29 23:51:48
C# winfo
要找么写数据库查询方法才能 读取到
我要查询的语句返回的 最后一个 影响行数
追款日期
-----------
48
48
47
48
48
48

(6 行受影响)
C#的winforms的DAL层
写成一个方法来读取 记录这个! select datediff(day,ClientOrdersStartDate,getdate())
from [ClientOrders] where convert(varchar(30),ClientOrdersStartDate,120)
LIKE '%2009-03%'
要不就修改这个 把它返回的不是表里面的数据 而是返回 有行受到影响!

好像没有什么可行的办法,如果你想取这个值的话,只能按照你的选择条件先
select count(*) from table_name where 条件;

**补充***
select count(datediff(day,ClientOrdersStartDate,getdate()))
from [ClientOrders]
where convert(varchar(30),ClientOrdersStartDate,120) LIKE '%2009-03%';

---
以上,希望对你有所帮助。

记得ADO .NET中,用ExecuteNonQuery()方法,对连接执行 Transact-SQL 语句并返回受影响的行数。

执行sql语句的时候是有个返回值的,就是这个值

Dim a as Integer=ds.Tables(0).Rows.Count