Hi
I am trying to add a new column to dataset and trying to display field values in my own formated table. (not in a datagrid or datatable)
i am using dataset to print values selected by sql statement in my format. As in my Table there are no unique or autoID column available. when i display data in table it works fine but now i want to print particular row of that table and i added print function to row column.
Problem started here: i dont have any id column to fetch that row straight in to print view page and print. For this reason i want to add a Autoincrement new column to my dataset and use it when user will click on print. (i want to use autoincrement number as id to print function in order to fetch the data)
Dim dc As DataColumndc =
New DataColumndc.AutoIncrement =
Truedc.Unique =
Falsedc.DataType = Type.GetType("System.Int32")
dc.AutoIncrementSeed = -1
dc.AutoIncrementStep = -1
dc.ColumnName = "Jagjot"
'dc.DefaultValue = 21dc.ReadOnly =
Falsemyda.Fill(ds, "REL_FRFS") ....
and displaying in my table using
myDset.Tables("REL_FRFS").Rows(f).Item("ENVIRONMENT")
After all my efforts auto increment dosent work ! then i tried to do the same thing in datagrid and nothing happened then i turned Autogeneratecolumns to true and all the columns displayed including my ID column but again no data.. Same thing happened when i populated dataset ad added column to it using all necessary autoincrement attributes.. But i dont understand what is wrong..
i am using VS 2003 with SQLServer 2005
If any one can help it would be great help.

Autoincrement problem with dataset
Marino Fourotunis
Basically, you can create a new table, add the identity column, copy all the values of rows from the current table:
DataTable dtNew = ds.Tables["REL_FRFS"].Clone();
dt.Add(dc) // dc is the identity column you created
foreach (DataRow dr in ds.Tables["REL_FRFS"].Rows) {
dtNew.Rows.Add(dr.ItemArray);
}
// dtNew now is filled with identity values
Steve Wooster
Bill,
Thanks you very much! It worked Perfectly fine. Thanks for you help..
Jagjot Singh
Software/Database Developer