/// <summary>
        /// 根据数据库类型获取操作类
        /// <example >调用示例
        /// <code>
        /// yltl.DBUtility.DataBaseOper.GetDataBaseOper(AccessConnectionType.Oralce)
        /// </code>
        /// 返回:IDataBaseOper
        /// </example>
        /// 创建者:wls 20090902
        /// </summary>
        /// <param name="at">数据库类型</param>
        /// <returns>DataBaseOper 数据操作类</returns>
        public static IDataBaseOper GetDataBaseOper(eDBType dbtype)
        {
            switch (dbtype)
            {
            case eDBType.Access:
                if (dbOper_Access == null)
                {
                    dbOper_Access = new AccessHelper(dbtype);
                }
                return(dbOper_Access);

                break;

            case eDBType.Sybase:
                if (dbOper_Sybase == null)
                {
                    dbOper_Sybase = new SybaseHelper(dbtype);
                }
                return(dbOper_Sybase);

                break;

            case eDBType.Oracle:
                if (dbOper == null)
                {
                    dbOper = new OracleHelper(dbtype);
                }
                return(dbOper);

                break;
                break;

            case eDBType.SqlServer:
                if (dbOper_SqlServer == null)
                {
                    return(dbOper_SqlServer = new SqlServerHelper(dbtype));
                }
                return(dbOper_SqlServer);

                break;

            default:     //默认是本地库
                throw new NotImplementedException("未实现的数据库类型读取:" + dbtype.ToString());

                break;
            }

            return(null);
        }
        /// <summary>
        /// 根据数据库类型获取操作类
        /// </summary>
        /// <param name="at">数据库类型</param>
        /// <returns>DataBaseOper 数据操作类</returns>
        public static SybaseHelper GetDataBaseOper(eDBType at)
        {
            switch (at)
            {
            case eDBType.Access:
                if (dbOper_Sybase == null)
                {
                    dbOper_Sybase = new SybaseHelper(at);
                }
                return(dbOper_Sybase);

                break;

            case eDBType.Sybase:

                if (dbOper_Sybase == null)
                {
                    dbOper_Sybase = new SybaseHelper(at);
                }
                return(dbOper_Sybase);

                break;

            case eDBType.Custom:
                break;

            default:     //默认是本地库
                if (dbOper_Sybase == null)
                {
                    dbOper_Sybase = new SybaseHelper(at);
                }
                return(dbOper_Sybase);

                break;
            }

            return(null);
        }
        /// <summary>
        /// 在自定义数据库连接中根据数据库类型获取数据库连接
        /// </summary>
        /// <param name="at">数据库的连接方式</param>
        /// <param name="at2">自定义数据库的数据库类型</param>
        /// <param name="ServerName">(net)服务器名称</param>
        /// <param name="DataBaseName">数据库名称</param>
        /// <param name="UserIdName">用户</param>
        /// <param name="Password">密码</param>
        /// <returns></returns>
        public static SybaseHelper GetDataBaseOper(eDBType at, eDBType at2, string ServerName, string DataBaseName, string UserIdName, string Password)
        {
            switch (at)
            {
            case eDBType.Access:
            case eDBType.Oracle:
            case eDBType.SqlServer:
                break;

            case eDBType.Custom:
                if (dbOper_Custom != null)
                {
                    dbOper_Custom.ConnClose();     //先关闭 再连接
                }
                dbOper_Custom = new SybaseHelper(at2, ServerName, DataBaseName, UserIdName, Password);
                return(dbOper_Custom);

                break;

            default:     //默认是本地库
                break;
            }
            return(null);
        }
Beispiel #4
0
 /// <summary>
 /// 在自定义数据库连接中根据数据库类型获取数据库连接
 /// </summary>
 /// <param name="at">数据库的连接方式</param>
 /// <param name="at2">自定义数据库的数据库类型</param>
 /// <param name="ServerName">(net)服务器名称</param>
 /// <param name="DataBaseName">数据库名称</param>
 /// <param name="UserIdName">用户</param>
 /// <param name="Password">密码</param>
 /// <returns></returns>
 public static SybaseHelper GetDataBaseOper(eDBType at, eDBType at2, string ServerName, string DataBaseName, string UserIdName, string Password)
 {
     switch (at)
     {
         case eDBType.Access:
         case eDBType.Oracle:
         case eDBType.SqlServer:
             break;
         case eDBType.Custom:
             if (dbOper_Custom != null)
             {
                 dbOper_Custom.ConnClose(); //先关闭 再连接
             }
             dbOper_Custom = new SybaseHelper(at2, ServerName, DataBaseName, UserIdName, Password);
             return dbOper_Custom;
             break;
         default: //默认是本地库
             break;
     }
     return null;
 }
Beispiel #5
0
        /// <summary>
        /// 根据数据库类型获取操作类
        /// </summary>
        /// <param name="at">数据库类型</param>
        /// <returns>DataBaseOper 数据操作类</returns>
        public static SybaseHelper GetDataBaseOper(eDBType at)
        {
            switch (at)
            {
                case eDBType.Access:
                    if (dbOper_Sybase == null)
                    {
                        dbOper_Sybase = new SybaseHelper(at);
                    }
                    return dbOper_Sybase;

                    break;
                case eDBType.Sybase:

                    if (dbOper_Sybase == null)
                    {
                        dbOper_Sybase = new SybaseHelper(at);
                    }
                    return dbOper_Sybase;

                    break;
                case eDBType.Custom:
                    break;

                default: //默认是本地库
                    if (dbOper_Sybase == null)
                    {
                        dbOper_Sybase = new SybaseHelper(at);
                    }
                    return dbOper_Sybase;
                    break;
            }

            return null;
        }
Beispiel #6
0
        /// <summary>
        /// �������ݿ����ͻ�ȡ������
        /// <example >����ʾ��
        /// <code>
        /// yltl.DBUtility.DataBaseOper.GetDataBaseOper(AccessConnectionType.Oralce)
        /// </code>
        /// ���أ�IDataBaseOper 
        /// </example>
        /// �����ߣ�wls 20090902
        /// </summary>
        /// <param name="at">���ݿ�����</param>
        /// <returns>DataBaseOper ���ݲ�����</returns>
        public static IDataBaseOper GetDataBaseOper(eDBType dbtype)
        {
            switch (dbtype)
            {
                case eDBType.Access:
                    if (dbOper_Access == null)
                    {
                        dbOper_Access = new AccessHelper(dbtype);
                    }
                    return dbOper_Access;

                    break;
                case eDBType.Sybase:
                    if (dbOper_Sybase == null)
                    {
                        dbOper_Sybase = new SybaseHelper(dbtype);
                    }
                    return dbOper_Sybase;

                    break;
                case eDBType.Oracle:
                    if (dbOper == null)
                    {
                        dbOper = new OracleHelper(dbtype);
                    }
                    return dbOper;
                    break;
                    break;
                case eDBType.SqlServer:
                    if (dbOper_SqlServer == null)
                    {
                        return dbOper_SqlServer = new SqlServerHelper(dbtype);
                    }
                    return dbOper_SqlServer;
                    break;
                default: //Ĭ���DZ��ؿ�
                    throw new NotImplementedException("δʵ�ֵ����ݿ����Ͷ�ȡ:" + dbtype.ToString());

                    break;
            }

            return null;
        }