By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,146 Members | 1,631 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,146 IT Pros & Developers. It's quick & easy.

Dataset: How to Access specific column data?

P: n/a
When using a dataset, how can one get to a column data element using this
format:

dataset.Tables[0].Rows[0]....

I can get to a specific row, but I am not sure how to get to the column or
data. I tried using the keyword Column, but no luck.

Also, is direct access the best way to access this data, or should I be
using different DataRows, etc. Keywords

Thanks

Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
David,
Use .Columns[xx] where xx is either a number or a string with the field
name. You can also use a name for the Table index.
Ron Allen
"David M" <ma*****@aegiscomgroup.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
When using a dataset, how can one get to a column data element using this
format:

dataset.Tables[0].Rows[0]....

I can get to a specific row, but I am not sure how to get to the column or
data. I tried using the keyword Column, but no luck.

Also, is direct access the best way to access this data, or should I be
using different DataRows, etc. Keywords

Thanks

Nov 15 '05 #2

P: n/a
Try this:
ds.Tables[0].Rows[0][0]

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"David M" <ma*****@aegiscomgroup.com> schreef in bericht
news:Xn**********************************@207.46.2 48.16...
When using a dataset, how can one get to a column data element using this
format:

dataset.Tables[0].Rows[0]....

I can get to a specific row, but I am not sure how to get to the column or
data. I tried using the keyword Column, but no luck.

Also, is direct access the best way to access this data, or should I be
using different DataRows, etc. Keywords

Thanks

Nov 15 '05 #3

P: n/a
Oops,
Ignore the Columns in the previous and use just [xx] where xx is either
a string or integer key. I've been working with a custom control with a
Columns collection for about the last 2 days and my mind was 'stuck' on
columns.
Ron Allen
"Ron Allen" <rallen@_nospam_src-us.com> wrote in message
news:ef**************@TK2MSFTNGP09.phx.gbl...
David,
Use .Columns[xx] where xx is either a number or a string with the field
name. You can also use a name for the Table index.
Ron Allen
"David M" <ma*****@aegiscomgroup.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
When using a dataset, how can one get to a column data element using this format:

dataset.Tables[0].Rows[0]....

I can get to a specific row, but I am not sure how to get to the column or data. I tried using the keyword Column, but no luck.

Also, is direct access the best way to access this data, or should I be
using different DataRows, etc. Keywords

Thanks


Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.