csharp:存儲過程輸出參數,和返回值

 /// <summary>
        ///塗聚文 存儲過程輸出參數,和返回值
        /// 20131030
        /// Geovin Du
        /// </summary>
        /// <param name="rept"></param>
        /// <param name="apage"></param>
        /// <param name="vipno"></param>
        /// <param name="date"></param>
        /// <param name="alltotal"></param>
        /// <returns></returns>
        public DataTable SelectbirthdayVipdlyTotalPage(Repeater rept, AspNetPager apage, string vipno, DateTime date, out string alltotal)
        {
            DataTable dt = new DataTable();
            int pagecout = SelectVipInfoErroCount(vipno,date);
            try
            {
                SqlParameter[] par = new SqlParameter[]{
                new SqlParameter("@vipno", SqlDbType.NVarChar,30),//输入参数 
                new SqlParameter("@now", SqlDbType.DateTime),//输入参数  
                new SqlParameter("@alltotal", SqlDbType.Decimal,50),//输出参数 

                };
                par[0].Value = vipno;
                par[1].Value = date;
                par[2].Direction = ParameterDirection.Output; //ParameterDirection.ReturnValue; //
                using (DataTable reader = DBHelper.GetDataBindRepeaterAspNetPagerList(rept, apage, pagecout, 20, "View_birthdayVipdlyList", "proc_Select_birthdayVipdlyTotal", CommandType.StoredProcedure, par))
                {
                    dt = reader;
                    alltotal = par[2].Value.ToString();
                }
            }
            catch (SqlException ex)
            {

                throw ex;
            }

            return dt;

        }

你可能感兴趣的:(C#)