Tony wrote:
> Hello!
>
> I read a book and here is something that I don't understand. It might
> also be incorrect.
> It about when to use autoincreament and when you should not use it.
> "Do: Set the AutoIncrementSeed and AutoIncrementStep properties to -1
> prior to adding rows to your DataTable.
> Doing so ensure that you're generating placeholder values such as -1, -2
> -3 and so on. Assuming that you're set the autoincrement seed in your
> database to the default (1), ADO.NET is generating placeholder values
> that can not appear in your database.
> Even if you display this value in your application, it will prevent
> users from mistakenly assuming that the autoincrement values that ADO.NET
> generates will be the same as the ones the database will generate."
>
> What I want to say is that even if you set the AutoIncrementSeed to 1
> and AutoIncrementStep to 1 this will also work and will not cause any
> problem. This is because the values in the DataColumn is just
> placeholder and will most certain not be used in the database.
>
> I can see many advantages setting AutoIncrementSeed and
> AutoIncrementStep to -1.
>
Tony, the topic "Avoiding Auto-Increment Value Conflicts" may be helpful:
http://msdn.microsoft.com/en-us/libr...netbest_topic7