cancel
Showing results for 
Search instead for 
Did you mean: 

Insert a row in Datatable

Former Member
0 Kudos

Hi all,

I filled a datatable with a query.

Now i want to insert a row in the datatable but not at the end.

How can i do that?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Julien,

You can add a empty row to a datatable using

objDatatable.Rows.Add()

If you want to fill the data then you have to access that row with index and then fill the data

you can get the index of last added row like this (objDatatable.Rows.Count-1) as datatable row index starts with zero

Hope it helps you

Regards

Vishnu

Answers (1)

Answers (1)

Gianluigi
Product and Topic Expert
Product and Topic Expert
0 Kudos

I believe the method DataRows.Add has one parameter that is used for this.