Results 1 to 5 of 5

Thread: What's the difference between datasource, datatable, dataset etc...?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2013
    Posts
    200

    What's the difference between datasource, datatable, dataset etc...?

    Hello, I want to know what's the difference between datasource, datatable, dataset, dataadapter, datatableadapter, databindingsource and if there's any other objects for databases. Which ones should I use?

    And...
    I have an mdb database and I've been searching for hours for saving specific cell value after it's modified in a datagridview. The cell type is boolean. When I test the program and click on the checkbox and close the program and test it again, I see that the value isn't saved.
    Last edited by nikel; Mar 20th, 2015 at 11:21 PM.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,461

    Re: What's the difference between datasource, datatable, dataset etc...?

    With ADO.NET, you generally make a connection to your database and retrieve data to create a local copy. You then make changes to that local copy completely independently to the database itself. Finally, you save all the changes from the copy back to the database.

    So, you use an adapter to connect to the database and retrieve the data into a DataTable that may or may not be in a DataSet. You then bind the DataTable to a BindingSource and that to a DataGridView. As you make changes to the grid, those changes are automatically propagated to the DataTable, which is the whole point of data-binding. When you're done, call EndEdit on the BindingSource to ensure that any pending edit is committed and then use the same adapter to save the changes from the DataTable back to the database.

    You can use an untyped DataSet or DataTable and a data adapter or you can use a typed DataSet and a table adapter. The first option gives you more fine-grained control while the second option is easier and less error-prone for most common operations.

    If you want to go with the first option then you might follow the Database FAQ link in my signature below and check out the .NET resources there. If you prefer the second option, follow the Data Walkthroughs link instead. With regards to your first question, you might like to check out this link:

    http://www.vbforums.com/showthread.p...ion&highlight=

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2013
    Posts
    200

    Re: What's the difference between datasource, datatable, dataset etc...?

    Oh, I was feeling stupid when I asked this, because I thought there was something simple I should have known. My first guess was, they seperate from one another because of the version changes. Thanks for the detailed explanation.

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    23,403

    Re: What's the difference between datasource, datatable, dataset etc...?

    Here's an example you might find helpful:

    https://code.msdn.microsoft.com/DataBinding-91dfbcf4

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2013
    Posts
    200

    Re: What's the difference between datasource, datatable, dataset etc...?

    Quote Originally Posted by .paul. View Post
    Here's an example you might find helpful:

    https://code.msdn.microsoft.com/DataBinding-91dfbcf4
    That's very useful for me. Thanks a lot.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width