ExcuteScalar(),返回的是查询结果的第一行第一列,返回值是object类型,一般用来查询表中有多少条数据,求最大值等 现在我们用ExcuteScalar()做个测试,需求:我要查询学生表里面有多少条数据. 存储过程: IF OBJECT_ID('GetStudentsCountNum','P') IS NOT NULL DROP PROCEDURE GetStudentsCountNum GO CREATE PROCEDURE GetStudentsCountNum AS SELEC…
using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Reflection; namespace DAL.DataUtil { /// <summary> /// SqlServer数据访问控制类 /// </summary> public class DataProvider { public string Conne…