DataTable Particular row

Hi guys,
Can anybody help me how to get a specific row from the Data Table. For example in my Data Table I have 10 rows and 3 columns. I need to access only the 5th row item (all 3 values from the columns). What code should I use for this?

DT.Rows(4)
then
datarow.item(field1).value …

1 Like

Hi Atrimal, I tried your code, but .value is not supporting. what should I provide in (field1). Is it column index? I want to get all column values for that particular row. Is it possible?

.tostring try

Hello @Atrimal

Try the below code

YourDataTable.Rows(4).Item(1).ToString

Change the number accordingly to get the record you need :slight_smile:

3 Likes

Hello @karthikd8,

try this:
Assign
DT = datatable.AsEnumerable().Take(5).Skip(4).CopyToDataTable

1 Like

Thank You Samir. It is working. That’s exactly what I wanted. :smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.