DataTable or BindingSource?? C# Question

I am using C# Windows Forms and dealing with databases and recordsets. I am finding that I have code that works the same using a bindingsource and datatable. You can see the code I have attached. Previously my code utilized the datatable, then as a test I modified a couple of lines of code to use the bindingsource instead and found that it works as well.

Can someone tell me the difference between these 2 items and which is better to use?

 
SqlConnection cn = new SqlConnection(PubVar.dbConn);
                cn.Open();

                SqlCommand cmd = new SqlCommand(PubVar.dbConn, cn);
                cmd.CommandText = "sp_LookupPrices";
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter param;
               
                param = cmd.Parameters.AddWithValue("@CustomerNumber", txtCustomerNumber.Text);
                param = cmd.Parameters.AddWithValue("@CustomerName", txtCustomerName.Text);
                param = cmd.Parameters.AddWithValue("@ProductNumber", txtProductNumber.Text);
                param = cmd.Parameters.AddWithValue("@ProductName", txtProductName.Text);
                param = cmd.Parameters.AddWithValue("@CompanyID", PubVar.CompanyID);
             
              //---OLD 1 line of code using the datatable
               // DataTable tbl = new DataTable();

                SqlDataReader rdr = cmd.ExecuteReader();

 
             //--OLD 2 lines of code using the datatable
               // tbl.Load(rdr);
                //dgPriceSearch.DataSource = tbl;


              //---new 2 lines of code using the bindingsource
                BindingSource bs1 = new BindingSource(rdr, null);
                dgPriceSearch.DataSource = bs1;


                rdr.Close();
                cn.Close();
            }
          catch (Exception ex)
          {
              MessageBox.Show(ex.Message);
          }
        }

Open in new window

SJRAdminAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Najam UddinCommented:
if data that u are getting from db can possibly change, then use binding source other wise it is better to use datatable

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
riaanvdlCommented:
As far as I know using BindingSource is quicker than using a DataTable because it binds directly to the datasource, where if you use a datatable you bind, then have to read the data and then load it.
BindingSource also provides a bit more functionality to data manipulation like currency management and change notification.

BindingSource is definately the way to go.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.