Click here to Skip to main content
13,355,726 members (62,169 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I Have A Database Of MS-Access.In That I Have Taken S.No. As Auto Number DataType..
I Had Inserted Some Data..Now For Each Row An Auto Number Is Generated In A Sequential Order For Example: 1,2,3 To so on...Now If I Delete A Row Which Is In The Middle Of All The Rows(Record), For Suppose I Have 1 2 3 4 5 6 7 8 9 10 Records Are There. If I Deleted 5th Record,Then In The S.No. Column(AutoNumber DataType) It Shows Only 1 2 3 4 6 7 8 9 10 by Missing The Deleted Number.

Now My Question Is That Can We Rearrange The S.No. Column Order As 1 2 3 4 5 6 7 8 9 in The MS- Access Database Using C# Windows Application.

pls Help Me..
Posted 8-Dec-12 22:30pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can, but it is a very bad idea. The problem is two-fold:
Firstly, the "row number" is an identity - it makes the row unique, and cannot be repeated. It is used by other tables to identify the row specifically, and to tie for example the items on an invoice (in one table) to the specific invoice identifying the transaction in another. If you reorder the "row numbers" in the invoice table, you must also re-order the corresponding numbers in the invoice items table, or a customer will get billed for items he did not order.
Secondly, there is a reasonable chance that this will not be used by just one user: what happens if two users delete two different rows at the same time? The permutations of what could go wrong are enormous, and can cause seriously unpredictable bugs.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180111.1 | Last Updated 9 Dec 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100