/// <summary> /// 根据数据库类型获取操作类 /// </summary> /// <param name="at">数据库类型</param> /// <returns>DataBaseOper 数据操作类</returns> public static SqlServerHelper GetDataBaseOper(eDBType at) { switch (at) { case eDBType.SqlServer : if (dbOper_SqlServer == null) { return dbOper_SqlServer = new SqlServerHelper(at); } return dbOper_SqlServer; break; case eDBType.Custom: break; default : 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 SqlServerHelper 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 SqlServerHelper(at2, ServerName, DataBaseName, UserIdName, Password); return dbOper_Custom; break; default: break; } return null; }
/// <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; }