Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

EntLib 6 Data Access Block with Oracle 11G - Why select doesn't return values?

$
0
0

To clarify this code works with other tables and views. When trying to access SYS.v_$archive_log no error is thrown but know results are returned. Please help me understand what I am doing incorrectly.

---------- Code Sample Below -------------------------

using EntLibContrib.Data.OdpNet;
using Microsoft.Practices.EnterpriseLibrary.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling;
using Microsoft.Practices.EnterpriseLibrary.Logging;
using Microsoft.Practices.EnterpriseLibrary.Logging.Database;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A_DataGuard_Checker
{
    class Program
    {
        static void Main(string[] args)
        {
            // Configure the DatabaseFactory to read its configuration from the app.config file
            DatabaseProviderFactory factory = new DatabaseProviderFactory();

            // Create a database object from the factory using the connection string name.
            Database example = factory.Create("orcl");

            // Call the ExecuteReader method by specifying the command type
            // as a SQL statement, and passing in the SQL statement.
            using (IDataReader reader = example.ExecuteReader(CommandType.Text, "select * from sys.v_$archived_log"))
            {
                // Display the values
                DisplayRowValues(reader);
            }
            Console.WriteLine("Press <enter> to exit...");
            Console.ReadLine();
        }

        static void DisplayRowValues(IDataReader reader)
        {
            while (reader.Read())
            {
                for (int i =0; i < reader.FieldCount; i++)
                {
                    Console.WriteLine("{0} = {1}", reader.GetName(i), reader[i].ToString());
                }
            }
        }
    }
}


Brett L. Brown


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>