Results 1 to 4 of 4

Thread: Creating dataset, table adapter, binding source(...) and everything else in code

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2009
    Posts
    31

    Creating dataset, table adapter, binding source(...) and everything else in code

    Hi!
    Can you please explain me and/or show some good tutorials how to do it?
    It seems pretty complicated because visual studio usually does it all for you and that made me stupid and not to do anything about it.
    Things I don't know to do in code but I know VS does it for me:
    -connection string
    -dataset
    -tableadapter
    -bindingsource
    -bindingnavigator
    -table adapter methods and queries
    ...
    I'm sure there is a good tutorial somewhere on the internet.

    I'm okay with doing it with designer, but now when I have a situation where I can't use MDI container but tabcontrol.
    Other solution would be to make a MDI container out of tabcontrol. Is it posible or only other form can be MDI container.


    Thank you for your help and your time!

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Dec 2009
    Posts
    31

    Re: Creating dataset, table adapter, binding source(...) and everything else in code

    Sorry I'm posting again. I figured out that I can do everything on a "workspace", custom made user control but I had some problems with that:
    -after closing and redimensioning the "workspace" (with dataset, datagrids and everything) my application crashes.
    I believe that when I dispose the workspace, dataset doesn't become disposed.
    If I could fix that, I wouldn't have to do anything in the code.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,303

    Re: Creating dataset, table adapter, binding source(...) and everything else in code

    You don't create TableAdapters in code. TableAdapters are generated at design time. If you want to do it all in code then you use DataAdapters. All these things you're talking about are just classes, like any other. You create an instance in code using the New keyword to invoke a constructor, just like other classes. You set properties and call methods, just like other classes. They are also the same properties you set in the designer, e.g. the DataSource of a BindingSource.

    For examples of how to write ADO.NET code, follow the Database FAQ link in my signature and check out the .NET resources there. Amongst others, you'll find a link to my Retrieving & Saving Data thread in the CodeBank.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Dec 2009
    Posts
    31

    Re: Creating dataset, table adapter, binding source(...) and everything else in code


    Thank you! I will sure do read your database faq!
    It's something that can't be learned totally intuitive and with no good literature.

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