winapp: how to access tableadapter in dataset.xsd

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nev
    Contributor
    • Oct 2007
    • 251

    winapp: how to access tableadapter in dataset.xsd

    i used the datasources wizard to add table "lamesa" to my dataset. if i view the xsd file, "lamesa" has a tableadapter named "lamesatableada pter".

    but when i do msgbox(lamesa.d efaultview.coun t.tostring) it is equal to 0. i have 5 records.

    i want to code something like this to fill "lamesa"...

    lamesatabledapt er.fill(dataset .lamesa)

    but i don't know how to reference the lamesatableadap ter in the xsd file.

    please help solve my problem. thank you.
  • Shashi Sadasivan
    Recognized Expert Top Contributor
    • Aug 2007
    • 1435

    #2
    Hi,
    lamesatableadap ter is considered as an object
    so you have to create an object of it to access it.

    the folowing should give you some idea
    [CODE=cpp]lamesatableadap ter lamesaAdapter = new lamesatableadap ter();
    lamesaTable lametable = new lamesaTable;
    lamesaAdapter.f ill(lametable);[/CODE]

    as you write this, intellisense whould guide you.

    However please consider the namesapaces

    Comment

    • nev
      Contributor
      • Oct 2007
      • 251

      #3
      Originally posted by Shashi Sadasivan
      Hi,
      lamesatableadap ter is considered as an object
      so you have to create an object of it to access it.

      the folowing should give you some idea
      [CODE=cpp]lamesatableadap ter lamesaAdapter = new lamesatableadap ter();
      lamesaTable lametable = new lamesaTable;
      lamesaAdapter.f ill(lametable);[/CODE]

      as you write this, intellisense whould guide you.

      However please consider the namesapaces
      thank you for the quick response. but wasn't this already created after i used the datasources wizard? i can view and click it in the xsd file. the wizard generated a datatable along with a tableadapter.

      if i drag and drop the datatable or any of its field in my form, the tableadapter object will automatically be created in my form so i can simply do...

      me.tableadapter .fill(dataset.d atatable)

      but since i did not dragndrop the datatable in my form, i cannot use the 'me'? which lead me to try to reference the tableadapter like this...

      dataset.xsd*.ta bleadapter.fill (dataset.datata ble)

      which is of course dumb.

      i hope anyone knows how to do this?

      Comment

      • Shashi Sadasivan
        Recognized Expert Top Contributor
        • Aug 2007
        • 1435

        #4
        Hi,
        I havent used any other ORM tools (unfortunately been only working with SQL server)
        however the whole concept of the XSD file is that it is also accompanied by a class file.
        the class file contains the definitions for the table adapter.

        have you chosen the right namespaces?

        Comment

        • nev
          Contributor
          • Oct 2007
          • 251

          #5
          thank you, i added the component before accessing it.

          Comment

          • nev
            Contributor
            • Oct 2007
            • 251

            #6
            wow! a couple days passed and i completely forgot how i added the component. i also dont know how to remove it again. it is a tableadapter component.

            Comment

            Working...