/// <summary> /// �������ݿ����ϵͳö�����ͺ������ַ�������һ���µ����ݷ��ʶ���ʵ�� /// </summary> /// <param name="DbmsType">���ݿ�����ý�飬��ACCESS/MYSQL/ORACLE/SQLSERVER/SYSBASE/UNKNOWN </param> /// <param name="ConnectionString">�����ַ���</param> /// <returns>���ݷ��ʶ���</returns> public static DMEDb_AdoHelper GetDBHelper(DMEDb_DBMSType DbmsType, string ConnectionString) { string EngineType = ""; switch (DbmsType) { case DMEDb_DBMSType.Access: EngineType = "OleDb"; break; case DMEDb_DBMSType.MySql: EngineType = "Odbc"; break; case DMEDb_DBMSType.Oracle: EngineType = "Oracle"; break; case DMEDb_DBMSType.SqlServer: EngineType = "SqlServer"; break; case DMEDb_DBMSType.SqlServerCe : EngineType = "SqlServerCe"; break; case DMEDb_DBMSType.Sysbase: EngineType = "OleDb"; break; case DMEDb_DBMSType.SQLite: EngineType = "SQLite"; break; case DMEDb_DBMSType.UNKNOWN: EngineType = "Odbc"; break; } DMEDb_AdoHelper helper = GetDBHelper(EngineType); helper.ConnectionString = ConnectionString; return helper; }
/// <summary> /// 使用指定的数据库类型初始化本类 /// </summary> /// <param name="dbType"></param> public DMEDb_CommandInfo(DMEDb_DBMSType dbType) { this.DataBaseType = dbType; }
/// <summary> /// ����SQL��ҳ��䣬��¼����Ϊ0��ʾ����ͳ����� /// </summary> /// <param name="dbmsType">���ݿ�����</param> /// <param name="strSQLInfo">ԭʼSQL���</param> /// <param name="strWhere">�ڷ�ҳǰҪ�滻���ַ��������ڷ�ҳǰ��ɸѡ</param> /// <param name="PageSize">ҳ��С</param> /// <param name="PageNumber">ҳ��</param> /// <param name="AllCount">��¼�����������0������ͳ�Ƽ�¼�����IJ�ѯ</param> /// <returns>����SQL��ҳ���</returns> public static string MakeSQLStringByPage(DMEDb_DBMSType dbmsType, string strSQLInfo, string strWhere, int PageSize, int PageNumber, int AllCount) { //���ݲ�ͬ�����ݿ�������ò�ͬ������ string SQL = string.Empty; switch (dbmsType) { case DMEDb_DBMSType.Access: case DMEDb_DBMSType.SqlServer: SQL = MakePageSQLStringByMSSQL(strSQLInfo, strWhere, PageSize, PageNumber, AllCount); break; case DMEDb_DBMSType.Oracle: SQL = MakePageSQLStringByOracle(strSQLInfo, strWhere, PageSize, PageNumber, AllCount); break; case DMEDb_DBMSType.MySql: case DMEDb_DBMSType.SQLite: SQL = MakePageSQLStringByMySQL(strSQLInfo, strWhere, PageSize, PageNumber, AllCount); break; case DMEDb_DBMSType.PostgreSQL: SQL = MakePageSQLStringByPostgreSQL(strSQLInfo, strWhere, PageSize, PageNumber, AllCount); break; default: //SQL = MakePageSQLStringByMSSQL(strSQLInfo, strWhere, PageSize, PageNumber, AllCount); //SQL = strSQLInfo; //break; throw new Exception("��ҳ����֧�ִ������͵����ݿ��ҳ��"); } return SQL; }
//基本查找路径模板 /// <summary> /// 构造函数 /// </summary> /// <param name="SqlTextPath">配置文件路径</param> /// <param name="ScriptType">数据类型</param> /// <remarks></remarks> public DMEDb_XmlCommand(string SqlTextPath, DMEDb_DBMSType ScriptType) { this.SqlTextPath = SqlTextPath; this.ScriptType = ScriptType; }