Help with adding a column to dataset or datagrid

sunnyjulka

Member
Joined
Sep 12, 2005
Messages
17
Programming Experience
1-3
Hello everyone
I have a application that displays products from my inventory table in the datagrid. I use a dataadapter to fill the dataset. Now every thing is fine but I want to add another column (say Row no.), which starts with value 1 and increment its value by one every time another row is added in dataset. Is there a way to do this. Any help would be appriciated.
Thanks
 
Add new element to your dataset and name it (like MyNewColumn) and set type Integer. Then before calling fill method of dataadapter (or something elese) put this code:

VB.NET:
[SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].myDataset.Tables("myTable").Columns("MyNewColumn").AutoIncrement = [/SIZE][SIZE=2][COLOR=#0000ff]True
[/COLOR][/SIZE]
 
Back
Top