internal override DBDatabaseList GetDatabaseList()
        {
            OpenDB();
            SqlCommand cmd = new SqlCommand
            {
                Connection  = conn,
                CommandText = "SELECT name FROM sys.databases WHERE name NOT IN('master', 'tempdb', 'model', 'msdb', 'ReportServer', 'ReportServerTempDB')"
            };

            DBDatabaseList DbDl = new DBDatabaseList
            {
                Databases = new Dictionary <string, DBInfo>()
            };
            SqlDataReader dr;

            try
            {
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    DBInfo di = new DBInfo
                    {
                        Name = dr["name"].ToString()
                    };
                    DbDl.Databases.Add(di.Name, di);
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally { CloseDB(); }
            return(DbDl);
        }
예제 #2
0
        internal override DBDatabaseList GetDatabaseList()
        {
            DBDatabaseList DbDl = new DBDatabaseList();

            DbDl.Databases = new Dictionary <string, DBInfo>();
            List <string> dsnList = GetDsnList();

            foreach (string dsn in dsnList)
            {
                DBInfo di = new DBInfo();
                di.Name = dsn;
                DbDl.Databases.Add(di.Name, di);
            }
            return(DbDl);
        }
예제 #3
0
        internal override DBDatabaseList GetDatabaseList()
        {
            OpenDB();
            IDbCommand cmd = (IDbCommand)assMySql.CreateInstance(MySqlCommandClass, true);

            cmd.Connection  = conn;
            cmd.CommandText = "Show Schemas";
            IDataReader dr = cmd.ExecuteReader();

            DBDatabaseList DbDl = new DBDatabaseList();

            DbDl.Databases = new Dictionary <string, DBInfo>();

            while (dr.Read())
            {
                DBInfo di = new DBInfo();
                di.Name = dr["Database"].ToString();
                DbDl.Databases.Add(di.Name, di);
            }
            dr.Close();
            CloseDB();
            return(DbDl);
        }