469,317 Members | 1,903 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,317 developers. It's quick & easy.

Getting the index number of a column in a datarow in a strongly typed dataset...

Hi.

I'm using a strongly typed dataset and I would like to get the index number
of a column from a datarow. Is that possible? I would like to avoid using
expression like this,

myTable.Columns.IndexOf("myColumnName")

Thanks.
Dec 11 '05 #1
3 8564
Programatix,
I'm using a strongly typed dataset and I would like to get the index
number of a column from a datarow. Is that possible? I would like to avoid
using expression like this,

myTable.Columns.IndexOf("myColumnName")

What expression you like to avoid in this, this is a very normal VBNet
construction and therefore I do not understand it. This will however not
even be enough, you will have to use a fore index loop through the
columnnames which are than 3 rows of code.

Cor
Dec 12 '05 #2
As I said, I'm using a strongly typed dataset. Anyway, I found out the way.
Goes something like this,

Let's assume that I have a dataset called dsDataset which a table called
dtTable. There is a column called ID in dtTable.

To retrieve the Index of the column ID,
dsDataset.dtTable.Columns.Indexof(dsDataset.dtTabl e.IDColumn)

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Programatix,
I'm using a strongly typed dataset and I would like to get the index
number of a column from a datarow. Is that possible? I would like to
avoid using expression like this,

myTable.Columns.IndexOf("myColumnName")

What expression you like to avoid in this, this is a very normal VBNet
construction and therefore I do not understand it. This will however not
even be enough, you will have to use a fore index loop through the
columnnames which are than 3 rows of code.

Cor

Dec 12 '05 #3
Now, I can't help wondering which one is faster.... too lazy to go and
benchmark them...

"Programatix" <N$********************@msn.com> wrote in message
news:e$**************@TK2MSFTNGP10.phx.gbl...
As I said, I'm using a strongly typed dataset. Anyway, I found out the
way. Goes something like this,

Let's assume that I have a dataset called dsDataset which a table called
dtTable. There is a column called ID in dtTable.

To retrieve the Index of the column ID,
dsDataset.dtTable.Columns.Indexof(dsDataset.dtTabl e.IDColumn)

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Programatix,
I'm using a strongly typed dataset and I would like to get the index
number of a column from a datarow. Is that possible? I would like to
avoid using expression like this,

myTable.Columns.IndexOf("myColumnName")

What expression you like to avoid in this, this is a very normal VBNet
construction and therefore I do not understand it. This will however not
even be enough, you will have to use a fore index loop through the
columnnames which are than 3 rows of code.

Cor


Dec 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by John Latten | last post: by
80 posts views Thread by Bibby | last post: by
1 post views Thread by Yama | last post: by
reply views Thread by Doug | last post: by
11 posts views Thread by Tim Frawley | last post: by
13 posts views Thread by MadCrazyNewbie | last post: by
3 posts views Thread by glenn | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.