These records are only inserted by one person. It's an import program so
there can never be multiple users.
DataTable dt = new DataTable("MyTable");
da.Fill(dt);
// set the AutoIncrement properties for the column.
....
DataRow dr = dt.NewRow();
....
....
dt.Rows.Add(dr);
It seems the seed only applies if the DataTable is empty to begin with.
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:#(E-Mail Removed)...
> Hi Joe,
>
> Autoincrement applies only when you create new rows in memory (in
> DataTable).
> Where exactly are your news rows comming from?
> How do you create them?
>
> --
> Miha Markic [MVP C#] - RightHand .NET consulting & development
> www.rthand.com
> SLODUG - Slovene Developer Users Group www.codezone-si.info
>
> "Joe" <J_no_spam@_no_spam_Fishinbrain.com> wrote in message
> news:(E-Mail Removed)...
> > Given the following code new rows should have their AutoIncrement column
> > set
> > to -1, -2, -3, etc... but this isn't the case.
> >
> > When I inspect the new row it shows the last positive value -1 for the
new
> > row yet when I look at the column both Auto properties are set as below.
I
> > double verified by looking at the row than col like this:
> > datatable.Rows[45]["idx"] and the column datatable.Columns["idx"]. This
> > way
> > I know I'm looking at the right item.
> > In addition, when inspecting the newrow I see that rowID = -1, newRecord
> > = -1.
> >
> >
> > da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
> > da.Fill(dt);
> >
> > foreach (DataColumn c in dt.Columns)
> > {
> > if (c.AutoIncrement == true)
> > {
> > c.AutoIncrementSeed = -1;
> > c.AutoIncrementStep = -1;
> > break;
> > }
> > }
> >
> > I hope I'm just overlooking something.
> >
> >
>
>