Batch Updates from a Grid

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

    #1

    Batch Updates from a Grid

    Hello,

    Doing my first ASP project so this may be simple and I'm missing
    something...cou ld someone please calrify this for me?

    1. I have an ASP page with a grich which allows user to add, edit and
    delete records.

    2. The grid is linked to an objectdatasourc e which points to a
    business class

    3. The business class has the usual add/edit/ delete methods which in
    turn pass these requests through to a tableadapter which I generated
    using the data set designer.

    4. The table adapter is using stored procedures to do the insert /
    edit / delete

    5. In this scenario the grid is adding records / deleting etc.
    directly to the database. I want this to behave more like a windows
    style grid where the updates are not sent to the actual database until
    the I execute the update method.

    Is there a standard way of doing this? My initial thoughts were to
    have the business class's update / insert / delete methods work on a
    datatable which I create from the initial select, then have an update
    method that jsut calls teh table adapters update method, but how this
    works is making my head spin a little. Presumably I'll have to have
    the datatable sent to and from the client as part of the session - is
    this correct?

    I'm guessing in general this is not a good idea but in this case there
    will be at msoat 20 records or so.

    If I'm correct and this is the best way to go, I guess my business
    class will have to retrieve the dataTable from the session for each
    delete / update / insert operation?

    Cheers in advance,

    Ray

  • =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=

    #2
    RE: Batch Updates from a Grid

    Essentially, you can pass a DataTable that has any combination of new,
    deleted and / or modified rows into a DataAdapter's Update method and as long
    as you have the correct insert, delete and update commands, it will process
    all the rows at once.

    So really all you need to do is engineer the way to do this that is most
    comfortable for your situation.
    -- Peter
    Site: http://www.eggheadcafe.com
    UnBlog: http://petesbloggerama.blogspot.com
    Short Urls & more: http://ittyurl.net


    "rbrowning1 958" wrote:
    Hello,
    >
    Doing my first ASP project so this may be simple and I'm missing
    something...cou ld someone please calrify this for me?
    >
    1. I have an ASP page with a grich which allows user to add, edit and
    delete records.
    >
    2. The grid is linked to an objectdatasourc e which points to a
    business class
    >
    3. The business class has the usual add/edit/ delete methods which in
    turn pass these requests through to a tableadapter which I generated
    using the data set designer.
    >
    4. The table adapter is using stored procedures to do the insert /
    edit / delete
    >
    5. In this scenario the grid is adding records / deleting etc.
    directly to the database. I want this to behave more like a windows
    style grid where the updates are not sent to the actual database until
    the I execute the update method.
    >
    Is there a standard way of doing this? My initial thoughts were to
    have the business class's update / insert / delete methods work on a
    datatable which I create from the initial select, then have an update
    method that jsut calls teh table adapters update method, but how this
    works is making my head spin a little. Presumably I'll have to have
    the datatable sent to and from the client as part of the session - is
    this correct?
    >
    I'm guessing in general this is not a good idea but in this case there
    will be at msoat 20 records or so.
    >
    If I'm correct and this is the best way to go, I guess my business
    class will have to retrieve the dataTable from the session for each
    delete / update / insert operation?
    >
    Cheers in advance,
    >
    Ray
    >
    >

    Comment

    • rbrowning1958

      #3
      Re: Batch Updates from a Grid

      Hi Peter,

      Thanks for replying. I know about the update method and how it can
      batch things for you but I suppose I'm a little unclear as to how this
      works in a web environment. If my business object adds things to a
      datatable or a dataset then updates when requested, rather than
      directly to the databse, where does the datatable / dataset get
      stored? Doesn't it need to be part of the session?

      Cheers

      Ray

      On Apr 12, 7:01 pm, Peter Bromberg [C# MVP]
      <pbromb...@yaho o.NoSpamMaam.co mwrote:
      Essentially, you can pass a DataTable that has any combination of new,
      deleted and / or modified rows into a DataAdapter's Update method and as long
      as you have the correct insert, delete and update commands, it will process
      all the rows at once.
      >
      So really all you need to do is engineer the way to do this that is most
      comfortable for your situation.
      -- Peter
      Site:http://www.eggheadcafe.com
      UnBlog:http://petesbloggerama.blogspot.com
      Short Urls & more:http://ittyurl.net
      >
      >
      >
      "rbrowning1 958" wrote:
      Hello,
      >
      Doing my first ASP project so this may be simple and I'm missing
      something...cou ld someone please calrify this for me?
      >
      1. I have an ASP page with a grich which allows user to add, edit and
      delete records.
      >
      2. The grid is linked to an objectdatasourc e which points to a
      business class
      >
      3. The business class has the usual add/edit/ delete methods which in
      turn pass these requests through to a tableadapter which I generated
      using the data set designer.
      >
      4. The table adapter is using stored procedures to do the insert /
      edit / delete
      >
      5. In this scenario the grid is adding records / deleting etc.
      directly to the database. I want this to behave more like a windows
      style grid where the updates are not sent to the actual database until
      the I execute the update method.
      >
      Is there a standard way of doing this? My initial thoughts were to
      have the business class's update / insert / delete methods work on a
      datatable which I create from the initial select, then have an update
      method that jsut calls teh table adapters update method, but how this
      works is making my head spin a little. Presumably I'll have to have
      the datatable sent to and from the client as part of the session - is
      this correct?
      >
      I'm guessing in general this is not a good idea but in this case there
      will be at msoat 20 records or so.
      >
      If I'm correct and this is the best way to go, I guess my business
      class will have to retrieve the dataTable from the session for each
      delete / update / insert operation?
      >
      Cheers in advance,
      >
      Ray- Hide quoted text -
      >
      - Show quoted text -

      Comment

      Working...