Example #1
0
        /// <summary>
        ///  �������ݿ����ͻ�ȡ������
        ///  �����ߣ�ycf 
        ///  ����ʱ�䣺 20100304
        /// <example >����ʾ��
        /// <code>
        /// yltl.DBUtility.DataBaseOper.GetDataBaseOper(ConnectionString)
        /// </code>
        /// ���أ�IDataBaseOper 
        /// </example>        /// 
        /// </summary>
        /// <param name="ConnectionString">access���ݿ������ַ���</param>
        /// <returns></returns>
        public static IDataBaseOper GetDataBaseOper_ConnectionString(string ConnectionString)
        {
            dbOper_Access = new AccessHelper(ConnectionString);

            return dbOper_Access;
        }
Example #2
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;
        }
        private static Hashtable dbOper_Custom_Hashtable;//自定义的数据库连接 只有接口中定义的方法 保持连接的

        #region  获取数据库连接
        /// <summary>
        ///  根据数据库类型获取操作类
        ///  创建者:ycf
        ///  创建时间: 20100304
        /// <example >调用示例
        /// <code>
        /// yltl.DBUtility.DataBaseOper.GetDataBaseOper(ConnectionString)
        /// </code>
        /// 返回:IDataBaseOper
        /// </example>        ///
        /// </summary>
        /// <param name="ConnectionString">access数据库连接字符串</param>
        /// <returns></returns>
        public static IDataBaseOper GetDataBaseOper_ConnectionString(string ConnectionString)
        {
            dbOper_Access = new AccessHelper(ConnectionString);

            return(dbOper_Access);
        }