如何获取数据库中一张表的总条数谢谢了,大神帮忙啊

2025-04-16 16:19:45
推荐回答(1个)
回答1:

我是这么写的 ALTER PROCEDURE GetCount AS SELECT COUNT(*) FROM [AllMessage] RETURN public int Count() { int RowCount; string Constr = ConfigurationManager.ConnectionStrings["Constr"].ConnectionString; SqlHelper GetCount = new SqlHelper(); RowCount = Convert.ToInt32(GetCount.ExecuteScalar(Constr, CommandType.StoredProcedure, "GetCount")); return RowCount; }