> it was exactly what i was looking for and it works great. > see below.. > > //get the highest primary key value in the datatable. > int MaxPKey = Convert.ToInt16(ds.Tables[0].Compute("MAX > (pay_adjust_id)","pay_adjust_id <> -1")); > > //add the new primary key > dr["pay_adjust_id"] = MaxPKey + 1;
That may work, but is still more complex and harder for someone else to follow than: ds.Tables[0].Columns["pay_adjust_id"].AutoIncrement = true; DataRow dr= ds.Tables[0].NewRow(); // ...assign the fields, except primary key ds.Tables[0].Rows.Add(dr); Something to keep in mind for the future... ------------------------ Yahoo! Groups Sponsor --------------------~--> Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar. Now with Pop-Up Blocker. Get it for free! http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/