Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TableAdapter vs BindingSource, curious about what is what?

Status
Not open for further replies.

jsteph

Technical User
Oct 24, 2002
2,562
0
0
US
Hi all,
(Using vs 2008)
I've just started working with datagridviews, and am trying to set them up so they're reading live data. I'd added a datatable to the dataset, and when that datatable is created, it auotmaically creates a TableAdapter (I'm starting to getting confused...3 objects and all I wanted was one table...a view actually).

Anyway, in Properties of the dgv, I choose the dataTable. Yet now there's a fourth object, a BindingSource--which I can't ever really see in the Project Explorer, it's just sort of a mysterious thing that appears and I have no idea why it's there.

So everything works, and that's not the question. I've read until I was blue in the face about these objects from Microsoft's docs, and what I'm really hoping is that someone can either point me to some 'Normal human readable' text about the why's and what's of these four objects, or mabye give me a quick primer on how they relate?

I think I understand the "DataSet", that seems to be just a graphical container/namespace for one's dataTables.

What I don't get is the relationship and difference between DataTable, TableAdapter, and BindingSource. They seem almost interchangeable but in code and in various controls' properties it seems you have to use a specific one and it just seems somewhat redundant.
Thanks for any help.
--Jim
 
They are definitely not interchangeable, they all have a specific role.

The DataTable is the in-memory data.

TableAdapters communicates between your application and a database, executes queries, updates, procedures etc. All of this can be setup from the dataset, this is where you create your queries to define the data you want to fill the control, define concurrency resolution, updates etc.

The BindingSource binds controls ie. DataGridView to the data source. The BindingSource is setup automatically and you really don't have to do anything with it. It can be used for moving through or filtering your data, BindingSource.MoveNext(), BindingSource.Filter("") etc.

I hope this helps.
 
Kliot,
Thanks very much, that does help me get a bead on it. I'm going to have to just bat them around in a test environment to get used to it all.
--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top