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

ado.net快速上手疑问及解答(完结篇)

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

        {

        }

        static MapperUtill()
        {
            try
            {
                cmdTimeOut = int.Parse(ConfigurationManager.AppSettings["db_timeOut"]);
            }
            catch
            {
                cmdTimeOut = 15;
            }
            try
            {
                sqlType = int.Parse(ConfigurationManager.AppSettings["sqlType"]);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            //实例化SqlDbMapper
            for (int i = 0; i < ConfigurationManager.ConnectionStrings.Count; i++)
            {
                string key = ConfigurationManager.ConnectionStrings[i].Name;
                string value = ConfigurationManager.ConnectionStrings[i].ConnectionString;
                CreateMapper(key, value, cmdTimeOut);
            }
        }

        public static ISqlMapper GetSqlMapper(string key)
        {
            return MapperUtill.GetMapper(key);
        }

        public static ISqlMapper GetCurrentSqlMapper()
        {
            return MapperUtill.GetMapper(currentSqlKey);
        }

        public static void CreateMapper(string connKey, string sqlConStr, int connTimeOut)
        {
            IDbOperation operation = null;
            switch (sqlType)
            {
                default:
                case 0:
                    operation = new SqlServer(sqlConStr, connTimeOut);
                    break;
                case 1:
                    //operation = new Orcale(sqlConStr, connTimeOut);//Orcale 未实现
                    break;
                case 2:
                    //operation = new MySql(sqlConStr, connTimeOut);//MySql 也没有实现呢
                    break;

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