Updating a dataadapter

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mfleet1973@yahoo.ca

    #1

    Updating a dataadapter

    Hi Gang.

    I'm using VB.Net 2003. In the following code I'm updating the
    dataadapter with a new record added to the table:

    OleDbDataAdapte r1.Update(DataS et11.GetChanges , "Table")

    However, when I add another record and update the dataadapter again,
    the first record gets added a second time. Is there something else
    that needs to be done after doing the update?

    Thanks a lot!!

    Mike.

  • Steven Nagy

    #2
    Re: Updating a dataadapter

    Rather than calling DataSet11.GetCh anges, just call the Dataset.
    Ie:

    OleDbDataAdapte r1.Update(DataS et11, "Table")

    Alternatively you can keep your existing code and call:
    DataSet11.Accep tChanges()
    after the line of code specified below.



    mfleet1973@yaho o.ca wrote:[color=blue]
    > Hi Gang.
    >
    > I'm using VB.Net 2003. In the following code I'm updating the
    > dataadapter with a new record added to the table:
    >
    > OleDbDataAdapte r1.Update(DataS et11.GetChanges , "Table")
    >
    > However, when I add another record and update the dataadapter again,
    > the first record gets added a second time. Is there something else
    > that needs to be done after doing the update?
    >
    > Thanks a lot!!
    >
    > Mike.[/color]

    Comment

    • Cor Ligthert [MVP]

      #3
      Re: Updating a dataadapter

      MFleet,

      In addition to Steven, this behaviour is because the getchanges creates a
      copy dataset.

      Cor

      <mfleet1973@yah oo.ca> schreef in bericht
      news:1150850626 .501497.99630@p 79g2000cwp.goog legroups.com...[color=blue]
      > Hi Gang.
      >
      > I'm using VB.Net 2003. In the following code I'm updating the
      > dataadapter with a new record added to the table:
      >
      > OleDbDataAdapte r1.Update(DataS et11.GetChanges , "Table")
      >
      > However, when I add another record and update the dataadapter again,
      > the first record gets added a second time. Is there something else
      > that needs to be done after doing the update?
      >
      > Thanks a lot!!
      >
      > Mike.
      >[/color]


      Comment

      Working...