none
copy dataset RRS feed

  • Question

  • hi

    which is the difference in coping Dataset in this two way

    dim Ds1 as dataset

    ....

    (fill the dataset

    ...

    dim Ds2 as dataset = Ds1

    and this way

    dim Ds1 as dataset

    ....

    (fill the dataset)

    ...

    dim Ds2 as dataset = Ds1.copy 

    Saturday, January 6, 2018 11:15 AM

Answers

  • There is really no difference between the two unless you have pre-existing data then we need to consider preserving data which moves away from using = or Copy but move to using DataSet.Merge.

    It's always wise to use the method based approach as it's crystal clear what you are doing down the road.

    Using copy

    • If the target DataSet doesn't contain a table by the same name, a fresh copy of the table is created but not with the latter method.
    • If a table by the same name is already in the target dataset then it will get merged with the one passed to Meerge and you end up with a mix of the two.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Marked as answer by Claudio111 Saturday, January 6, 2018 11:45 AM
    Saturday, January 6, 2018 11:41 AM
    Moderator