Exemple #1
0
        public static void TestGetReaderProperty()
        {
            try
            {
                myConnection.Open();
                SqlCommand cmd = new SqlCommand("select * from sys.tables");
                cmd.Connection = myConnection;
                var reader = cmd.ExecuteReader();
                var helper = new SqlDataHelper(reader);

                foreach (var prop in myConnection.GetType().GetProperties())
                {
                    Console.WriteLine(helper.GetReaderProperty(prop.Name));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            finally
            {
                myConnection.Close();
            }
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            myConnection.Open();
            SqlDataReader myReader  = null;
            var           query     = "SELECT  * " + "FROM    TABLE_BUG";
            SqlCommand    myCommand = new SqlCommand(query, myConnection);

            myReader = myCommand.ExecuteReader();
            helper   = new SqlDataHelper(myReader);
            var result = helper.Fetch(20);

            helper.GetReaderProperty("Fetched");
            Console.ReadLine();
        }
        public static void TestGetReaderProperty()
        {
            try
            {
                myConnection.Open();
                SqlCommand cmd = new SqlCommand("select * from sys.tables");
                cmd.Connection = myConnection;
                var reader = cmd.ExecuteReader();
                var helper = new SqlDataHelper(reader);

                foreach (var prop in myConnection.GetType().GetProperties())
                    Console.WriteLine(helper.GetReaderProperty( prop.Name));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            finally
            {
                myConnection.Close();
            }
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            myConnection.Open();
            SqlDataReader myReader = null;
            var helper = new SqlDataHelper();

            var state = helper.GetConnectionProperty(myConnection, "State");
            var query = "SELECT  * " + "FROM    TABLE_BUG";
            SqlCommand myCommand = new SqlCommand(query, myConnection);
            myReader = myCommand.ExecuteReader();
            helper = new SqlDataHelper(myReader);
            var result = helper.Fetch(20);
            helper.GetReaderProperty("Fetched");
            Console.ReadLine();
        }