Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. update datatable with adapter.update()

update datatable with adapter.update()

Scheduled Pinned Locked Moved C#
questionannouncement
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hamid_m
    wrote on last edited by
    #1

    i fill a datatable with dataadapter and bind it to an bindingsource one of my function return max(id) from above datatable: datarow[] rows = ds.tables[0].select("id=max(id)"); also datatble has updated whenever needed by: datable dt=ds.tables[0].getchanges(); adapter.update(dt); ds.acceptchanges(); my function (select last id) work correctly for first update, but it dosn't work after add one new record, and return same record. why? :confused:

    R 1 Reply Last reply
    0
    • H hamid_m

      i fill a datatable with dataadapter and bind it to an bindingsource one of my function return max(id) from above datatable: datarow[] rows = ds.tables[0].select("id=max(id)"); also datatble has updated whenever needed by: datable dt=ds.tables[0].getchanges(); adapter.update(dt); ds.acceptchanges(); my function (select last id) work correctly for first update, but it dosn't work after add one new record, and return same record. why? :confused:

      R Offline
      R Offline
      RepliCrux
      wrote on last edited by
      #2

      Try to update the dataset instead of the datatable, and avoind performing dataset acceptchanges. If your Datatable is bound to the control, once you update the adapter, may be the call the binding again. Ofcourse your best friend is debugging.

      H 1 Reply Last reply
      0
      • R RepliCrux

        Try to update the dataset instead of the datatable, and avoind performing dataset acceptchanges. If your Datatable is bound to the control, once you update the adapter, may be the call the binding again. Ofcourse your best friend is debugging.

        H Offline
        H Offline
        hamid_m
        wrote on last edited by
        #3

        thanks but your solution dos not fix it. i don't have problem with update dataset or datatable, because both has update as well. but select function dosnt work probably :sigh:

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups