예제 #1
0
        public ExpandoObject ExecuteExpandoObject(string sql, params object[] paras)
        {
            var     scalarBuiler = WhereHelper.CreateScalarWhere(sql, paras);
            DataSet ds           = ExecuteQuery(scalarBuiler.Where, paras);

            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
            {
                return(null);
            }

            foreach (DataTable table in ds.Tables)
            {
                foreach (DataRow row in table.Rows)
                {
                    IDictionary <string, object> expando = new ExpandoObject();
                    foreach (DataColumn column in table.Columns)
                    {
                        expando.Add(column.Caption, row[column]);
                    }

                    return((ExpandoObject)expando);
                }
            }
            return(null);
        }
예제 #2
0
        public DataSet ExecuteQueryScalar(string sql, params object[] paras)
        {
            if (paras != null && paras.Length > 0 && paras[0] is IDictionary <string, object> )
            {
                return(ExecuteQueryDict(sql, (IDictionary <string, object>)paras[0]));
            }
            var scalarBuiler = WhereHelper.CreateScalarWhere(sql, paras);

            return(ExecuteQuery(scalarBuiler.Where, scalarBuiler.SqlParameters.ToArray()));
        }
예제 #3
0
        public PageResult <T> QueryPage(string where, string order, int pageIndex, int pageSize, params object[] paras)
        {
            var scalarBuiler = WhereHelper.CreateScalarWhere(where, paras);

            return(QueryPage(scalarBuiler.Where, scalarBuiler.Paras, order, pageIndex, pageSize));
        }
예제 #4
0
        public List <T> Query(string where, string order = "", params object[] paras)
        {
            var scalarBuiler = WhereHelper.CreateScalarWhere(where, paras);

            return(Query(scalarBuiler.Where, scalarBuiler.Paras, order));
        }
예제 #5
0
        public ExPageResult ExecutePageExpandoObjects(string sql, string order, int pageIndex, int pageSize, params object[] paras)
        {
            var scalarBuiler = WhereHelper.CreateScalarWhere(sql, paras);

            return(ExecutePageExpandoObjects(scalarBuiler.Where, scalarBuiler.Paras, order, pageIndex, pageSize));
        }
예제 #6
0
        public IEnumerable <ExpandoObject> ExecuteExpandoObjects(string sql, params object[] paras)
        {
            var scalarBuiler = WhereHelper.CreateScalarWhere(sql, paras);

            return(ExecuteExpandoObjects(scalarBuiler.Where, scalarBuiler.SqlParameters));
        }