Sign in to follow this  
Followers 0

Why does this code run like hell? Populate DataGridView with LINQ

1 post in this topic

Partial Form Code

        // Form Load

        private void FrmBuildersManageLoad(object sender, EventArgs e)


            // Controller

            LstBuilders.MultiSelect = false;

            LstBuilders.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

            LstBuilders.DataSource = Accessor.DisplayBuilders();



Partial Accessor Code


    public class BuildersResults


        public string Builder { get; set; }

        public string Address { get; set; }

        public string City { get; set; }

        public string State { get; set; }

        public string Zip { get; set; }

        public string PhoneNumber { get; set; }

        public string FaxNumber { get; set; }

        public string EmailAddress { get; set; }


        // Get Full Table of Builders

        public static List<BuildersResults> DisplayBuilders()


            var dataConnect = new PxLinqSqlDataContext();

            return (from b in dataConnect.GetTable<TblBuilders>()

                    select new BuildersResults


                        Builder = b.Contact,

                        Address = b.Address,

                        City = b.City,

                        EmailAddress = b.EmailAddress,

                        FaxNumber = b.FaxNumber,

                        PhoneNumber = b.PhoneNumber,

                        State = b.State,

                        Zip = b.Zip               



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.