Ejemplo n.º 1
0
        private async void CarregarCamposAsync(string schema, string tabela)
        {
            DataTable    colunas;
            Configurador configurador = new Configurador();

            Dominio.Configuracao configuracao = configurador.RetornarConfiguracao();
            Conexao conexao = new Conexao(configuracao);

            string query = string.Format(@" SELECT C.COLUMN_NAME AS COLUNA
                                            FROM INFORMATION_SCHEMA.TABLES T WITH(NOLOCK)
                                            INNER JOIN INFORMATION_SCHEMA.COLUMNS C WITH(NOLOCK) ON T.TABLE_CATALOG = C.TABLE_CATALOG AND
	                                            T.TABLE_NAME = C.TABLE_NAME
                                            WHERE T.TABLE_SCHEMA = '{1}' AND C.TABLE_NAME = '{0}'", tabela, schema);

            colunas = await conexao.RetornarDadosAsync(query);

            dgvColunas.DataSource = colunas;
        }