From: A. Walker on
Hello,

I have a table with datarows 1, 2 and I want to add a new row x between
1 and 2. The result I want is 1, 2(formerly x), 3(formerly 2).

There is a method DataRowCollection.InsertAt which works well for the
dataset. But when I write the dataset to the database the new row will
be written as last row. (Result: 1, 2, x)

I assume this is a result of my primarykey column named ID (autonumber).

What do I have to change to get the desired result?

Thx for your help
From: Jesse Houwing on
* A. Walker wrote, On 4-11-2009 9:19:
> Hello,
>
> I have a table with datarows 1, 2 and I want to add a new row x between
> 1 and 2. The result I want is 1, 2(formerly x), 3(formerly 2).
>
> There is a method DataRowCollection.InsertAt which works well for the
> dataset. But when I write the dataset to the database the new row will
> be written as last row. (Result: 1, 2, x)
>
> I assume this is a result of my primarykey column named ID (autonumber).
>
> What do I have to change to get the desired result?
>
> Thx for your help

The only way to accomplish this is to add a column to your table in
which you specify the order (unless order can be deducted by ordering
the rows based on an existing column).

Then when loading the data, sort it based on the 'order' column using
the Order By clause.

Btw, this isn't really a .NET question, more a database question. You'll
no doubt get a more extensive explanation in the sqlserver.programming
newsgroup.


Jesse

--
Jesse Houwing
jesse.houwing at sogeti.nl