免费邮箱 |加入收藏 | 会员中心 | 我要投稿 | RSS
您当前的位置:首页 > .NET专区 > ASP.NET应用

ado.net快速上手实践篇(一)

时间:2011-05-21 10:43:51  来源:站内  作者:潘春会

        }

        public override IList<T> QueryForList<T>(string sqlStr, CommandType cmdType, List<DbParameter> listParams)
        {
            return QueryForList<T>(sqlStr, cmdType, listParams, typeof(T));
        }

        public override IList<T> QueryForList<T>(string sqlStr, CommandType cmdType, List<DbParameter> listParams, Type objType)
        {
            return ModelConverter.QueryForList<T>(sqlStr, cmdType, listParams, objType, this.CurrentDbOperation);
        }

        #endregion

        #region query for dictionary

        public override IDictionary<K, T> QueryForDictionary<K, T>(string key, string sqlStr)
        {
            return QueryForDictionary<K, T>(key, sqlStr, CommandType.Text, null, typeof(T));
        }

        public override IDictionary<K, T> QueryForDictionary<K, T>(string key, string sqlStr, Type objType)
        {
            return QueryForDictionary<K, T>(key, sqlStr, CommandType.Text, null, objType);
        }

        public override IDictionary<K, T> QueryForDictionary<K, T>(string key, string sqlStr, CommandType cmdType, Type objType)
        {
            return QueryForDictionary<K, T>(key, sqlStr, cmdType, null, objType);
        }

        public override IDictionary<K, T> QueryForDictionary<K, T>(string key, string sqlStr, CommandType cmdType, List<DbParameter> listParams, Type objType)
        {
            return ModelConverter.QueryForDictionary<K, T>(key, sqlStr, cmdType, listParams, objType, this.CurrentDbOperation);
        }

        #endregion

        #region dataset datatable

        public override DataTable FillDataTable(string sqlStr, CommandType cmdType, List<DbParameter> listParams)
        {
            return this.CurrentDbOperation.FillDataTable(sqlStr, cmdType, listParams);
        }

        public override DataSet FillDataSet(string sqlStr, CommandType cmdType, List<DbParameter> listParams)
        {
            return this.CurrentDbOperation.FillDataSet(sqlStr, cmdType, listParams);
        }

        #endregion

        #region ExecuteScalar

        public override object ExecuteScalar(string sqlStr, CommandType cmdType, List<DbParameter> listParams)
        {
            return this.CurrentDbOperation.ExecuteScalar(sqlStr, cmdType, listParams);
        }

        #endregion

        #region insert

        public override int Insert(string sqlStr)
        {
            object obj = ExecuteScalar(sqlStr, CommandType.Text, null);
            int id = obj == null ? 0 : int.Parse(obj.ToString());
            return id;

来顶一下
返回首页
返回首页
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表
推荐资讯
如何找出DHCP地址池里未使用的IP地址
如何找出DHCP地址池里
国内常用的DNS列表
国内常用的DNS列表
Linux邮件服务器软件比较
Linux邮件服务器软件比
学用纯CSS打造可折叠树状菜单
学用纯CSS打造可折叠树
相关文章
栏目更新
栏目热门