using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["str"].ConnectionString)) { conn.Open(); using (SqlCommand rscm = new SqlCommand("Proc_Paged", conn)) { rscm.CommandType = CommandType.StoredProcedure; SqlParameter param = new SqlParameter("@pageIndex", SqlDbType.Int); param.Direction = ParameterDirection.Input; param.Value = pageindex; rscm.Parameters.Add(param); param = new SqlParameter("@pageSize", SqlDbType.Int); param.Direction = ParameterDirection.Input; param.Value = pagesize; rscm.Parameters.Add(param); param = new SqlParameter("@total", SqlDbType.Int);