Exemplo n.º 1
0
        private void PopulateDatabasesAndRoles( )
        {
            bsDbs.DataSource = null;
            _tblDbs.Clear();
            _roleMap.Clear();
            SqlDataReader reader = null;

            using (SqlConnection conn = _cp.CreateSqlConnection(true))
            {
                reader = DbCmd.GetDatabasesAsDataReader(conn);
                DataRow row = null;
                try
                {
                    while (reader.Read())
                    {
                        row             = _tblDbs.NewRow();
                        row["Database"] = reader["name"];
                        row["Id"]       = reader["dbid"];
                        row["Map"]      = false;
                        _tblDbs.Rows.Add(row);

                        PopulateRoles((string)row["Database"], (short)row["Id"]);
                    }
                }
                finally
                {
                    if (reader != null)
                    {
                        reader.Close();
                    }
                }
            }

            bsDbs.DataSource = _tblDbs;
        }