Sorry if this is has an obvious answer, but I can't find it...
I am using a datatable.selec t to obtain the rows in a datatable that meet
certain criteria. My question is this: for each of the datarows that are
returned to me as a result of the datatable.selec t how can I determine their
index in the datatable.rows collection?
For those interested in why, it is because the index in the datatable is the
same as the index of the same row in an infergistics ultragrid control, and
I need to access that row in the grid, and the grid itself does not have the
equivalent of the "datatable.sele ct", so I would have to scan through all
the rows which would be too inefficient. So, I'm sort of cheating by using
the fact that the field I'm searching for is a primary key and I can use the
datatable.selec t method to quickly find it. Hopefully, I can then use the
index of the datatable as the index into the ultragrid to access my row.
Thanks, John 2 8980
Hi, http://www.vb-tips.com/default.aspx?...5-b1ec09f63071
Ken
-----------------
"JohnR" <Jo******@hotma il.com> wrote in message
news:NnT9f.334$ Ul3.226@trndny0 7... Sorry if this is has an obvious answer, but I can't find it...
I am using a datatable.selec t to obtain the rows in a datatable that meet certain criteria. My question is this: for each of the datarows that are returned to me as a result of the datatable.selec t how can I determine their index in the datatable.rows collection?
For those interested in why, it is because the index in the datatable is the same as the index of the same row in an infergistics ultragrid control, and I need to access that row in the grid, and the grid itself does not have the equivalent of the "datatable.sele ct", so I would have to scan through all the rows which would be too inefficient. So, I'm sort of cheating by using the fact that the field I'm searching for is a primary key and I can use the datatable.selec t method to quickly find it. Hopefully, I can then use the index of the datatable as the index into the ultragrid to access my row.
Thanks, John
Hi Ken,
Thanks for your response, but I'm a little confused... it seems your
example shows how to find the datarow given the position in the
currencymanager . What I am looking for is how to find the index of a row
that is returned to me as a result of a DataTable.Selec t method.
Something like this:
FoundRows = DataSet.Tables( "MyTable").Sele ct("MyField = 'Hi There'")
'return row where primary key is "Hi There"
dim dr as datarow = FoundRows(0) 'get the first found row
dim RowIndex as integer = dr.GetRowIndex 'of course there is no such
method, but it is what I am looking for
'once I have the rowindex I can do this:
dr = DataSet.Tables( "MyTable").rows (RowIndex) 'and this stmt will return
the same row as before
So my question is how can I find RowIndex for a DataRow given I have the
actual DataRow object?
Thanks, John
"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:u5******** *****@TK2MSFTNG P15.phx.gbl... Hi,
http://www.vb-tips.com/default.aspx?...5-b1ec09f63071
Ken ----------------- "JohnR" <Jo******@hotma il.com> wrote in message news:NnT9f.334$ Ul3.226@trndny0 7... Sorry if this is has an obvious answer, but I can't find it...
I am using a datatable.selec t to obtain the rows in a datatable that meet certain criteria. My question is this: for each of the datarows that are returned to me as a result of the datatable.selec t how can I determine their index in the datatable.rows collection?
For those interested in why, it is because the index in the datatable is the same as the index of the same row in an infergistics ultragrid control, and I need to access that row in the grid, and the grid itself does not have the equivalent of the "datatable.sele ct", so I would have to scan through all the rows which would be too inefficient. So, I'm sort of cheating by using the fact that the field I'm searching for is a primary key and I can use the datatable.selec t method to quickly find it. Hopefully, I can then use the index of the datatable as the index into the ultragrid to access my row.
Thanks, John
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Oliver Drobnik |
last post by:
Hi,
I have a datagrid bound to a datatable. Now if I sort the datagrid by
clicking on one of the column heads I can no longer use the index in the
datagrid to find the corresponding row in the datagrid.
How can I find out the new (sorted) index if I know the row in the
datatable?
kind regards
|
by: Clinton Pierce |
last post by:
I've filled a DataTable with columns that have custom type (a class that I'm
using to keep track of other things, not just a value). When the .Select
method goes to sort this column, how do I let .Net know what value I want
used for the sort?
Sometimes it's going to be sorted as a decimal and other times a string. I
don't really know which until runtime.
Thank you.
|
by: Ryan |
last post by:
Is there a way to get a row's DataView index from the underlying DataTable
index.
Example
DataTable (sorted by key - 1st column) DataView (sorted by second column)
Row 0 - A, 2 Row 0 - B, 1
Row 1 - B, 1 Row 1 - A, 2
Row 2 - C, 2 Row 2 - C, 2
I know the key of the row I want and can get the index of that row in the
|
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...
|
by: Craig |
last post by:
I know this is retarded but can you help: I'm using Visual Basic .net
and I'm trying to determine the row ID from a dataset find i.e.
Dim rowFoundRow As DataRow = DataSet11.Tables("Titles").Rows.Find(n)
the find returns successfully and if I browse the object in the
debuggger I can see the "rowid" and "oldrecord" and "newrecord" all
have pointers to the row's position, but as far as I can tell those
valuse are not accessable within my...
| |
by: Nathan Sokalski |
last post by:
I have a control that I want displayed in all items except the last one. I
figured the best way to do this was to determine whether the current item
was the last from within the ItemDataBound event using code such as the
following:
If e.Item.ItemIndex=(numberofitems-1) Then mycontrol.Enabled=False
but I cannot find a property that contains the total number of items before
|
by: dalaeth |
last post by:
I have searched Google high and low and haven't found anything that
works. Here's my problem, hopefully someone will be able to help!
I'm using 1.1 Framework, and ODP.NET 9.5.0.7 on a Windows 2003 Server.
I have a cached DataSet that I fill using an OracleDataAdapter. Changes
are made to that dataset in memory and as rows are changed, they are
updated back to the database using OracleDataAdapter.Update(DataRow).
Every few minutes, I...
|
by: =?Utf-8?B?UnlhbiBBbmRydXM=?= |
last post by:
Does the int index of the DataTable.Rows collection place a size limit on how
large a datatable can be?
If not then how do you index DataTable.Rows for sizes greater than what an
int can handle?
|
by: fniles |
last post by:
Can I create an index on a DataTable ?
On the following DataTable, I would like to create index on "Price", can I
do that ?
Thank you.
Dim DT As New DataTable
DT.Columns.Add("Price", GetType(System.Int32))
DT.Columns.Add("ID", GetType(System.Int32))
DT.Columns.Add("Vol", GetType(System.Int32))
|
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...
|
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,...
| |
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,...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |