Manipulating data between data adapters

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    #1

    Manipulating data between data adapters

    Hi

    I have two data adapters bound to two separate tables. How can I;

    1. Loop through all records one by one in one of them while reading column
    values, and

    2. Insert a record from data adapter A into data adapter B

    via code?

    Thanks

    Regards


  • Cor Ligthert [MVP]

    #2
    Re: Manipulating data between data adapters

    John,

    Don't call those things DataAdapters. It are DataSets, to be more precise
    Strongly Typed DataSets.

    A datarow in a table has a reference set to that table in the datarow. That
    is needed to know the description of the items which are in the Columns
    collection, even if it is not in the table.

    As well is there often not one row, but two rows, the original one and the
    current one in a datatable.

    All this makes it difficult to pull a row from one table and to place it in
    the other.

    The receiving table to be a clone of the sending one.

    Therefore it is mostly only possible to create a datarow in whatever way in
    the new table and than to fill the items for that.

    For that I like very much the loaddatarow from the datatable
    http://msdn2.microsoft.com/en-us/lib...addatarow.aspx

    Others like more the ItemArray property from the datarow
    http://msdn2.microsoft.com/en-us/lib...itemarray.aspx

    I hope this gives an idea,

    Cor
















    "John" <John@nospam.in fovis.co.ukschr eef in bericht
    news:eKMEhrlyGH A.4232@TK2MSFTN GP05.phx.gbl...
    Hi
    >
    I have two data adapters bound to two separate tables. How can I;
    >
    1. Loop through all records one by one in one of them while reading column
    values, and
    >
    2. Insert a record from data adapter A into data adapter B
    >
    via code?
    >
    Thanks
    >
    Regards
    >
    >

    Comment

    • Miha Markic [MVP C#]

      #3
      Re: Manipulating data between data adapters

      Hi John,

      I would use two commands and two connections.
      One command should read data while the other should write.
      But you'll need two connections - one per each command as reading needs a
      conneciton opened all the time.
      --
      Miha Markic [MVP C#, INETA Country Leader for Slovenia]
      RightHand .NET consulting & development www.rthand.com
      Blog: http://cs.rthand.com/blogs/blog_with_righthand/

      "John" <John@nospam.in fovis.co.ukwrot e in message
      news:eKMEhrlyGH A.4232@TK2MSFTN GP05.phx.gbl...
      Hi
      >
      I have two data adapters bound to two separate tables. How can I;
      >
      1. Loop through all records one by one in one of them while reading column
      values, and
      >
      2. Insert a record from data adapter A into data adapter B
      >
      via code?
      >
      Thanks
      >
      Regards
      >
      >

      Comment

      • William \(Bill\) Vaughn

        #4
        Re: Manipulating data between data adapters

        Ah no. Do not use ADO.NET for this (or any data access query interface). Use
        an INSERT to move the rows on the server (the database engine). Don't bring
        rows to your client to do bulk updates.

        --
        _______________ _______________ ______
        William (Bill) Vaughn
        Author, Mentor, Consultant
        Microsoft MVP
        INETA Speaker
        Welcome to the home of William Vaughn's Imagination, creations, and advice.

        Welcome to the home of William Vaughn's Imagination, creations, and advice.

        Please reply only to the newsgroup so that others can benefit.
        This posting is provided "AS IS" with no warranties, and confers no rights.
        _______________ _______________ ____

        "John" <John@nospam.in fovis.co.ukwrot e in message
        news:eKMEhrlyGH A.4232@TK2MSFTN GP05.phx.gbl...
        Hi
        >
        I have two data adapters bound to two separate tables. How can I;
        >
        1. Loop through all records one by one in one of them while reading column
        values, and
        >
        2. Insert a record from data adapter A into data adapter B
        >
        via code?
        >
        Thanks
        >
        Regards
        >
        >

        Comment

        Working...