Exemplo n.º 1
0
        /// <summary>
        /// 执行一个存储过程, 返回 T 类型的单值
        /// </summary>
        /// <param name="ProcedureName">存储过程名称</param>
        /// <param name="values">传入的值列表, 按照存储过程in类型参数的顺序赋值,跳过out参数</param>
        /// <returns>T 类型的单值</returns>
        internal protected virtual T ExecuteScalarProcedure <T>(string ProcedureName, params object[] values)
        {
            StoreProcedureInfo info = new StoreProcedureInfo();

            IDbDataParameter[] plist = GetProcedureParameters(ProcedureName, values);
            return(ExecuteScalarProcedure <T>(ProcedureName, plist));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 执行存储过程, 返回DataSet
        /// </summary>
        /// <param name="ProcedureName">存储过程名称</param>
        /// <param name="values">传入的值列表, 按照存储过程in类型参数的顺序赋值,跳过out参数</param>
        /// <returns>存储过程返回对象</returns>
        internal protected StoreProcedureInfo ExecuteProcedureDataSet(string ProcedureName, params object[] values)
        {
            StoreProcedureInfo info = new StoreProcedureInfo();

            IDataParameter[] plist = GetProcedureParameters(ProcedureName, values);

            info.ReturnCode = ExecuteProcedureDataSet(ProcedureName, out info.DataSet, plist);

            foreach (IDataParameter p in plist)
            {
                if (p.Direction == ParameterDirection.InputOutput ||
                    p.Direction == ParameterDirection.Output)
                {
                    info.OutputParameters.Add(p.ParameterName.Replace(MyDatabase.ParameterPrefix, ""), p.Value);
                }
            }

            return(info);
        }