Groups | Blog | Home
all groups > dotnet ado.net > march 2007 >

dotnet ado.net : Adding identity column to an existing DataTable



SoftLion
3/29/2007 3:25:24 PM
Hi all,
I'm trying to add an identity like column into an existing table of a
DataSet:

DataSet ds = ...
....
DataColumn identity = new DataColumn( "ROWINDEX", typeof(int) );
identity.AutoIncrement = true;
identity.AutoIncrementSeed = 0;
identity.AutoIncrementStep = 1;
ds.Tables[0].Columns.Add( identity );

When I inspect the value in the ROWINDEX column of each row, it seems
random (and the same value appears in different rows !!)
Any idea ? (using framework 1.1 with latest SP)



gfergo NO[at]SPAM gmail.com
3/30/2007 9:30:24 AM
SoftLion,

Can you post a little more code?

How was the DataTable created?

How are you "inspecting" the rows?

Thanks!




[quoted text, click to view]

AddThis Social Bookmark Button