C
cartoper
Data:
A line (row) containing multiple fields (columns)
Requirement:
1: Allow new lines to be inserted at any point
2: Allow deletion of any line
3: Keep the lines in the correct order
Examples:
When given a table with three lines:
Line 1
Line 2
Line 3
1: An insert after Line 2 makes Line 3 become Line 4 and the new Line
will be Line 3
2: A delete of Line 2 will make Line 3 become Line 2
Outside of ADO.Net, the lines would simply be a link list to make
insertion and deletion quick and easy. The objective is to use a
DataSet so that it can simply be bound to a DataGridView for display.
The best solution I have been able to come up with is to have an
ordinal number field that is hidden that initially increments by some
large amount, say 1000:
Line 1 (1000)
Line 2 (2000)
Line 3 (3000)
After inserting a line after Line 2 would result in this:
Line 1 (1000)
Line 2 (2000)
Line 3 (2500)
Line 4 (3000)
I imagine that this is an age old problem in relational databases and
there is a better solution. Does anyone know of a better way?
A line (row) containing multiple fields (columns)
Requirement:
1: Allow new lines to be inserted at any point
2: Allow deletion of any line
3: Keep the lines in the correct order
Examples:
When given a table with three lines:
Line 1
Line 2
Line 3
1: An insert after Line 2 makes Line 3 become Line 4 and the new Line
will be Line 3
2: A delete of Line 2 will make Line 3 become Line 2
Outside of ADO.Net, the lines would simply be a link list to make
insertion and deletion quick and easy. The objective is to use a
DataSet so that it can simply be bound to a DataGridView for display.
The best solution I have been able to come up with is to have an
ordinal number field that is hidden that initially increments by some
large amount, say 1000:
Line 1 (1000)
Line 2 (2000)
Line 3 (3000)
After inserting a line after Line 2 would result in this:
Line 1 (1000)
Line 2 (2000)
Line 3 (2500)
Line 4 (3000)
I imagine that this is an age old problem in relational databases and
there is a better solution. Does anyone know of a better way?