possible to extract column name in datarow?

P

Paul T

Hi,

I am looping through a dataset and each datarow has about 50 or so columns.
I can reference the column by using the index dr(0) or by name dr("column
name") and get the same result. What I want to do is be able to actually
extract the column name if I give it the index - the datasource is a csv
that may or may not change over time and I want to be able to handle it.
Logically, it is something like:

dr(0).ColumnName would return "column name" in this instance.
 
M

Marina

You would have to look at the column collection of the datatable the row
belongs to, and the column and the same index as the value you are looking
at.

Paul T said:
Hi,

I am looping through a dataset and each datarow has about 50 or so columns.
I can reference the column by using the index dr(0) or by name dr("column
name") and get the same result. What I want to do is be able to actually
extract the column name if I give it the index - the datasource is a csv
that may or may not change over time and I want to be able to handle it.
Logically, it is something like:

dr(0).ColumnName would return "column name" in this instance.




----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
C

Cor

Hi Paul,

ds.tables(0).rows.count gives the rows of the first table
ds.tables(0).columns.count gives the colums (items) of the first table.
ds.tables(0).columns(0).columname gives the name of the first column of the
first table.

I hope this helps?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top