Exemplo n.º 1
0
        /// <summary>
        /// 根据code和条件组装并执行sql,返回datatable的json
        /// </summary>
        /// <returns></returns>
        public string ExcuteSql()
        {
            //获得参数
            string code        = Request["code"].Trim();
            string queryParams = Request["queryParams"];//查询条件

            EasyMan.Dtos.ErrorInfo err = new EasyMan.Dtos.ErrorInfo();
            err.IsError = false;

            //执行sql语句
            try
            {
                DataTable dt = _reportAppService.GetDataTableFromCode(code, queryParams, ref err);
                if (err.IsError)
                {
                    throw new Exception(err.Message);
                }
                return(JSON.DecodeToStr(dt));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }