Click here to Skip to main content
15,885,954 members
Articles / Mobile Apps

Parse DataSet via Reflection

Rate me:
Please Sign up or sign in to vote.
4.18/5 (6 votes)
1 Sep 2009CPOL2 min read 25.6K   317   19  
This article shows how to bind relational data model with object design model
using System.Data;
using System.Windows;
using DataSetParser.BO;

namespace DataSetParser
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1
    {
        public Window1()
        {
            InitializeComponent();
            Loaded += OnLoaded;
        }

        void OnLoaded(object sender, RoutedEventArgs e)
        {
            const string sql =
                @"SELECT * FROM OrderLine INNER JOIN Customer 
				ON Customer.C_Id = OrderLine.O_CustomerId
						INNER JOIN Product 
				ON Product.P_Id = OrderLine.O_ProductId";
            DataTable dataTable = null;
            dataTable = DatabaseLayer.Instance.ExecuteTable(sql);
            lwOrderLines.ItemsSource = OrderLine.Get(dataTable);
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Comments and Discussions