CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Threaded View

  1. #1
    Join Date
    Jul 2010
    Posts
    50

    Exclamation Issue of Updating Serial Number in Database Table

    My entries are saved in a table having a field of Serial No alongwith other fields to keep them in sorted order. However when we reorder the record in MSFlexgrid/Listbox, what is the economical procedure adopted by professional to update that record order in the table.

    The example is given below:

    Sr. No., Saved Order, Changed Order

    1, A, A
    2, B, C
    3, C, B
    4, D, D
    5, E, E

    The letter C was placed previously at Sr. No.3. After shifting, it goes to Sr. No.2. My procedure is to store the previous index of letter “C” in a variable, open the table order by Sr. No. Move the record to InxdexVariable and change the value of field Sr. No. = IndexVariable -1 in case of shifting Up or Index Variable + 1 in case of Shifting Down. In a similar way I amend the second affecting record “B”.

    I would like also to know the procedure in case of removing a record and then updating the rest of Sr. Nos. in a table.
    Last edited by erncd1; July 30th, 2010 at 05:56 AM.

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

Featured