Dt.select using column index instead of column name


#1

Hi,

I am aware of the following method:

dt.Select("[Column Name] ="+"’"+blah+"’" ).CopyToDataTable

but I have a dynamic column name so using column index will be a better approach.
I got the column name using:

cName = dt.Columns(10).ColumnName

can someone direct me who to put this variable in dt.select?

I tried

dt1.Select(credit “> 0”).CopyToDataTable

dt1.Select(“credit > 0”).CopyToDataTable

They don’t work…

Thanks!
Lavina

Edit: I actually got it! ha - for those who have the same problem:

dt1.Select("[" + cName + “] > 0”).CopyToDataTable


#2

@lavint

dt.Select("[Column Name] =’"+dt.Columns(Column_Index).ColumnName.ToString+"’" ).CopyToDataTable

Regards,
Mahesh