Ejemplo n.º 1
0
        /// <summary>
        /// 返回单行数据
        /// </summary>
        /// <param name="parameters">参数</param>
        /// <returns></returns>
        public HashObject GetData(HashObject parameters, string sqlName = "getdata", SqlType sqlType = SqlType.SqlName)
        {
            //this.CheckForPrimary(parameters);//判断参数中是否包含主键列,如果不包含,抛出异常

            using (DbHelperWrapper dbhelper = new DbHelperWrapper(this._dbrwType, this._dbName, this._tableName, sqlName, parameters, sqlType))
            {
                dbhelper.LogEnable = this.LogEnable;
                HashObject result = dbhelper.GetData();
                return(result);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取指定列的值(传入)
        /// </summary>
        /// <param name="parameters"></param>
        /// <param name="selectColumns"></param>
        /// <param name="sqlType"></param>
        /// <returns></returns>
        public HashObject GetDataColumns(HashObject whereParameters, string[] selectColumns)
        {
            //this.CheckForPrimary(parameters);//判断参数中是否包含主键列,如果不包含,抛出异常
            string sql = SchemaManager.GetSelectColumnsSql(this._dbName, this._tableName, whereParameters, selectColumns);

            using (DbHelperWrapper dbhelper = new DbHelperWrapper(this._dbrwType, this._dbName, this._tableName, sql, whereParameters, SqlType.CmdText))
            {
                dbhelper.LogEnable = this.LogEnable;
                HashObject result = dbhelper.GetData();
                return(result);
            }
        }