473,386 Members | 1,654 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,386 software developers and data experts.

Retrieving index for a particular row from dataset

Hello All,

Was wondering if we could retrieve the index of a particular row from a
dataset's table based on the filter criteria for the row?

For example, I have 4 rows in my datatable which is inside a dataset. One of
the columns is "ID" field. If I want to retrieve the row index of a row with
ID = 10, is there any API which I could use in .NET framework.

I am using a kinda beginners code to compare each and every row's ID in a
for loop and deriving the index. If my datatable has >10000 rows, this
procedure is very inefficient.

Is there any efficient way to retrieve a row index?

TIA,
Diffi
Nov 19 '05 #1
1 1670
On Wed, 30 Mar 2005 14:45:04 -0600, Diffident
<Di*******@discussions.microsoft.com> wrote:
Hello All,

Was wondering if we could retrieve the index of a particular row from a
dataset's table based on the filter criteria for the row?

For example, I have 4 rows in my datatable which is inside a dataset.
One of
the columns is "ID" field. If I want to retrieve the row index of a row
with
ID = 10, is there any API which I could use in .NET framework.

I am using a kinda beginners code to compare each and every row's ID in a
for loop and deriving the index. If my datatable has >10000 rows, this
procedure is very inefficient.

Is there any efficient way to retrieve a row index?

TIA,
Diffi


Is the sort based on "ID"? If so, you can use a DataView:

http://groups-beta.google.com/group/...11bccc202ca28c

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rushabh Dadbhawala | last post by:
Problem: I am fetching data from the database, storing it in a dataSet, and binding it with a Data Grid. The DataGrid controls allows sorting. The problem is that when the data is sorted on one...
8
by: Christopher Weaver | last post by:
I'm having the hardest time doing the simplest thing. I have a DataGrid bound to a table in a master detail DataRelation within a DataSet relTaskActivities = new DataRelation("TaskActivities",...
3
by: Chris Thunell | last post by:
I have a Listbox on an vb aspx web page. When i select something in the listbox i do not get a selected value or selected index. The selected index is always -1. Any thoughts would be greatly...
3
by: Justin | last post by:
I have created a dataset with two tables and an insert command, I need to be able to retreive the Key Identity after inserting into table "A" for use in table "B". Should I use ExecuteScalar()...
0
by: Diffident | last post by:
Hello All, Was wondering if we could retrieve the index of a particular row from a dataset's table based on the filter criteria for the row? For example, I have 4 rows in my datatable which...
6
by: TB | last post by:
Hi All: Here´s a very simple question: I have created a datatable inside a dataset, and subsequently selected a particular row using certain criteria. How do get the index number of that...
3
by: DavidB | last post by:
New to .net....sorry if this seems repetitive I have a dataset ordered by date (SQLDataAdapter SelectCommand uses Order By) and want to find a record by a UniqueID(Identity Column). Then I want...
8
by: Joe Rattz | last post by:
Ok, I can't believe what I am seeing. I am sure I do this other places with no problems, but I sure can't here. I have some code that is indexing into the ItemArray in a DataSet's DataRow. I...
1
by: jimmyfo | last post by:
Hi, I recently wrote an ASP.Net web application in VS2005 and published (using VS2005 Publish feature) it to a relatively clean machine with ASP.Net 2.0 and MDAC 2.8 installed on it. However, when...
5
by: Randy Smith | last post by:
Hi ALL, I wonder if anyone has been using n-tier to bind to a GridView control by using the ObjectDataSource. This is our first OOP web application, and we have no tables. Right now we are...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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...
0
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,...
0
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...

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.