Results 1 to 7 of 7

Thread: Merge wont work??

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Merge wont work??

    I have the following code to write an xml file from "rsPick" and then merge "rsPick" with "rsArchive"


    '''''''''''''code''''''''''''''''''
    dsPick.WriteXml("C:\mydata.xml")

    daArchive.FillSchema(dsArchive,SchemaType.Source, "tblPick")
    daArchive.Fill(dsArchive, "tblPick")

    dsArchive.Merge(dsPick)
    daArchive.Update(dsArchive, "tblPick")
    '''''''''''''''''''''''''''''''''''''


    The xml file is written away succesfully but when I look at "tblPick" which is the access table acting as the source for dsArchive no new rows have been added!

    What am I doing wrong?

    Both schemas are similar.
    This is driving me nuts.

    Parksie

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    a dataset can have multiple tables, see if it added another table to the dataset with the other datasets info.

  3. #3

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018
    I know this is going to sound pig ignorrant Edneeis
    but how?

    I am not sure what you mean. Where do the tables come into play. I thought we where dealing directly with datasets.

    Parksie

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    A dataset is a collection of datatables which is a collection of datarows which is a collection of datacolumns.

    One way to find out is to call:
    Msgbox(dsPick.Tables.Count)

    before the merge and then again after.

  5. #5

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018
    I tried your messagebox :

    Msgbox(dsPick.Tables.Count)

    the result was 2. What does this mean? I am still struggling with this.

    Parksie

  6. #6

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018
    What I mean to say is that before the merge operation I have 1 table, and after I have 2 but the underlying database remains unchanged!


    Parksie

  7. #7
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    See it is merging the datasets not the tables. Also the database wouldn't be updated until you used the dataadapter again to update it, since all data is by default disconnected. You may want to loop through and add all the rows in the one to the table in the other.

    VB Code:
    1. 'something like this
    2. dim dr as DataRow
    3. For Each dr in ds1.Tables(0).Rows
    4.   ds2.Tables(0).Rows.Add(dr)
    5. Next

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