473,698 Members | 2,242 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("myCol umnName")

Thanks.
Dec 11 '05 #1
3 8788
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("myCol umnName")

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.dtTab le.Columns.Inde xof(dsDataset.d tTable.IDColumn )

"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP14.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("myCol umnName")

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...

"Programati x" <N$************ ********@msn.co m> wrote in message
news:e$******** ******@TK2MSFTN GP10.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.dtTab le.Columns.Inde xof(dsDataset.d tTable.IDColumn )

"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP14.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("myCol umnName")

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
447
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 database. This data contains a column that is a foreign key to another table. In my datagrid I don't want to display this keyvalue. Instead I want to use this key to get a description out of another table. I have added an extra column to both the...
1
6080
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
5255
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: Hireability Portability Flexibility The likely candidates seem to be Java, VB.Net, C, C++, C#.
1
1655
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 = new Customers(); XmlTextReader xmlReader = new XmlTextReader(stream); stream.Position = 0;
1
2180
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 Web Service it adds another Table to the DataSet that contains the data. I have to access the data using ds.Tables.Rows.ToString(). This defeats the whole purpose of using a strongly typed DataSet. Thanks in advance for the help.
0
1390
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 out the best way to do this. First question: I can get myself a new instance of a row and make changes to it, but presumably that's then a separate object from the original dataset row. How do I reconcile my changes back to the dataset?
11
27429
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 needs to be fast. Could I use a Dataview to filter for the value (which is unique) and return either the DataRow object so I can modify it and put it back into the DataSet the view is based on or somehow get the RowIndex in the DataSet that the...
13
1646
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 to modify my code below to include Datarows and Dataviews and maybe explain a little aswell? Many Thanks
3
3916
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 As System.Data.DataRow Dim dc As System.Data.DataColumn
0
8676
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8608
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9164
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9029
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8898
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8870
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7734
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.