0 Replies Latest reply on Mar 24, 2011 12:07 AM by anandbk

    Passing Dictionary Object to DB

    anandbk Level 1

      Hi Guys,


      I have to send values stored in Dictionary object (where value are the form of Key/Value pair ) to db. How or in what format i have to send this object to DB so that only those records of db table should be updated whose ID in the Dictionary object matches with table ID.




      I have a data grid which has Combobox as Itemrenderer in datagrid and when user modifies any values in the combo, i have to collect the modified combo values & its coressponding ID of the datagrid row and update the db table with user selected values.


      I am able to collect & store the modified combo values into Dictionary object in the form of Key/Value pair.

      In my case i have to collect the combo's modified value and its corressponding ID.


      For Ex: Assume that I have collected the ID & Combobox's modified value and store in to Dictionary object as Key/Value pari.



      ID (Table's ID column)                    Combobox's modified Value


      11                                                      A


      23                                                     M


      45                                                      Z



      So, I am storing the value in Dictionary object with ID as KEY & combobox's modified Value as the VALUE of the key.


      Now, I have to send the values stored in the Dictionary object to DB where only  the column of Combobox's Value in the table should be updated by checking the coressponding ID.


      How to send the Dictionary object to DB & in what format (i mean should it be converted to ArrayCollection or List, etc..) ?


      Can anyone please help in this regard with sample code.