Exemplo n.º 1
0
 /// <summary>
 /// 获取所有表(表名+表说明)【链接错误时,抛异常】
 /// </summary>
 /// <param name="conn">数据库链接</param>
 /// <param name="dbName">返回指定链接的数据库名称</param>
 /// <param name="errInfo">链接错误时的信息信息</param>
 public static Dictionary <string, string> GetTables(string conn, out string dbName, out string errInfo)
 {
     errInfo = string.Empty;
     using (DalBase helper = DalCreate.CreateDal(conn))
     {
         dbName = helper.DataBase;
         if (!helper.TestConn(AllowConnLevel.MaterBackupSlave))
         {
             errInfo = helper.DebugInfo.ToString();
             if (string.IsNullOrEmpty(errInfo))
             {
                 errInfo = helper.DataBaseType + " Open database fail : " + dbName;
             }
             return(null);
         }
     }
     return(TableSchema.GetTables(conn));//内部有缓存
 }
Exemplo n.º 2
0
        /// <summary>
        /// 获取所有表(表名+表说明)【链接错误时,抛异常】
        /// </summary>
        /// <param name="conn">数据库链接</param>
        /// <param name="dbName">返回指定链接的数据库名称</param>
        /// <param name="errInfo">链接错误时的信息信息</param>
        public static Dictionary <string, string> GetTables(string conn, out string dbName, out string errInfo)
        {
            errInfo = string.Empty;
            DbBase helper = DalCreate.CreateDal(conn);

            helper.IsAllowRecordSql = false;
            dbName = helper.DataBase;
            if (!helper.TestConn())
            {
                errInfo = helper.debugInfo.ToString();
                if (string.IsNullOrEmpty(errInfo))
                {
                    errInfo = "Open database fail : " + dbName;
                }
                helper.Dispose();
                return(null);
            }
            Dictionary <string, string> tables = TableSchema.GetTables(ref helper);//内部有缓存

            helper.Dispose();
            return(tables);
        }