473,383 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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 8769
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John Latten | last post by:
Hi there, I have got a problem when adding extra (= dummy) columns to a datagrid. I have a datagrid that is bound to a datatable. The datatable is filled with data from a SQL Server 2000...
1
by: Job Lot | last post by:
I am confused how strongly typed dataset is different from un-typed dataset. Is there any good link explaining pros and cons of both? Which one should be used preferably?
80
by: Bibby | last post by:
Hi, I'm interested in getting started in the programming world. I've dabbled in C, C++ and VB6. Which would be the best language to focus my attention to regarding the following considerations: ...
1
by: Yama | last post by:
Hi, I am really confused. I have created a strong typed dataset for Northwind database Customer table. Now I am loading it with a stream of XML (ADO style) with the following: Customers _cust...
1
by: HardBap | last post by:
I've created a strongly typed DataSet (Customers.xsd) using the xsd.exe tool. I want to be able to access fields using ds.Customer.CompanyName. The problem is when I return this DataSet from a...
0
by: Doug | last post by:
I've got a strongly-typed dataset with 2 related tables in it ("Staff" and "Roles"). I want to make a change to the parent Staff row and also to its child Role row. I'm having difficulty figuring...
11
by: Tim Frawley | last post by:
I need to return a DataRow or the Row Index in a DataSet wherein the value I am attempting to find is not a primary key. I have to do this often, more than 200 times when importing a file so it...
13
by: MadCrazyNewbie | last post by:
Hey Group, I wondered if somebody would be so kind as to help me? Im having trouble with DataViews and DataRows:( I just don`t understand, so I wondered if somebody would be so kind enought...
3
by: glenn | last post by:
Can anyone tell me how to pull data from a dataset? In my Page_Load function, I use the following code: Dim str As String Dim ds As System.Data.DataSet Dim dt As System.Data.DataTable Dim dr...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.