473,883 Members | 1,613 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Return DataRow or Row index from DataView

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 row corresponds to?
Nov 20 '05
11 27446
Tim,
Out of curiosity.

Does the DataTable.Selec t method change in speed if you create a DataView
first?

I may have to try some timings of my own later this weekend...

Hope this helps
Jay

"Tim Frawley" <ti*********@fi shgame.state.ak .us> wrote in message
news:%2******** *******@TK2MSFT NGP09.phx.gbl.. .


Wow, Thanks Peter, Cor, and Jay

I have some interesting results from your posts that I would like to
share. First of all, the methods, Table Select and DataView Find
methods both work. What I was not prepared for was the difference in
speed.

When I tested my application using the Table Select method it was taking
approximately 68 seconds to import 200 rows of data from a text file. I
then tested the DataView find method and low and behold, 33 seconds!

I know these times may seem extreme even though for me 33 seconds is an
awesome result. The data is extremely complicated and may contain up to
a hundred values on one row and each value may be inserted into any of
15 tables. We do not know from one value to the next which of those 15
tables will get the value. Thats what you get with Biological data. ;)

The value I am trying to find is in a primary table and it must exist
before the line is allowed to be imported. The value should be unique
but with an Access database anything could happen.

In any case, I want to thank all three of you for helping me out. I now
have a greater understanding of how to find my data and some great
methods for doing the job.

Much appreciated,

Timothy Frawley

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #11
Cor
Hi Jay B.

I intuitive take always the dataview.

We see it if you give samples about adonet with me it is usually
dataview(when I cannot use the find), while it is with you mostly
table.select and table.compute, which belong not to the set I like to use.
(To give you an idea about that, when I wrote RPG it was more assembler than
RPG, RPG I did use only for the logic and the IO).

When I looked at that, the words of Peter looked more than clear for me that
the dataview should use the same functionality as the select, because the
rowfilter is just the same, so why do it on another way. (They both should
iterate through a datarowcolletio n to find the equals and with answering
that I forgot all the things I know about tagsorts and things like that)

If the dataview builds tag indexes because of speed, than that can speed up
but also slow down the first time. Can you examine that also when you test
in this weekend?

Again is proven that the "best" method not exists.

:-) a little bit :-( but because I learned again something :-)))

Cor.

Nov 20 '05 #12

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

Similar topics

8
4138
by: Rodusa | last post by:
I am getting an error on line 133. I am trying to update a datarow using the find method, but it keeps throwing the error below: int ItemKey = dv.Find(Item.inv_mast_uid); DataRow dr; if (ItemKey==-1) // NOT FOUND { dr = dt.NewRow(); dr = Item.inv_mast_uid; dr = 1;
4
13158
by: Hein Albrecht | last post by:
'ello How can I get the DataRow of the DataGrid's SelectedItem for the bound DataView's DataTable? Thanx Hein
3
14694
by: Shravan | last post by:
Hi, How can I bind DataRow array to ComboBox. I tried setting DataSource -> DataRow Array DisplayMember -> ColumnName But it was showing "System.Data.DataRow" for every item in the combobox instead of fetching the
0
1715
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
4
1893
by: Maziar Aflatoun | last post by:
Hi, I have a DataRow that I want to bind to a dropdown list. I have 2 columns (TypeName, TypeValue). When do ddlNewAttribute.DataSource = drAttrValues; ddlNewAttribute.DataBind(); How do I go about binding to a specific column (TypeValue)?
13
1657
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
1
3242
by: Ryan Liu | last post by:
Hi, When my code run to DataRow.Delete() It throws: System.ArgumentOutOfRangeException: Non-negative number required. Parameter name: length at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array
8
11931
by: kimtherkelsen | last post by:
Hi, I do this: this.comboBox.DataSource = myDataSet.Tables.Select("location_key = " + selectedLocationKey); this.comboBox.DisplayMember = "text"; this.comboBox.ValueMember = "subcustomer_location_key"; but get an exception when setting the value member. Unfortunately there
5
39705
by: Rainer Queck | last post by:
Hello NG, what would be the best way to locate a DataRrow in a DataGridView? I have by DataTable.Select a bunch of DataRows from a DataTable (which is the data source to the DataGridView). Now I would like to give those related DataGridViewRows a different BackColor. Thanks for hints and help! Rainer
0
9940
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
11142
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...
1
10847
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
10415
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...
1
7971
isladogs
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...
0
7128
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
5991
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4612
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
2
4220
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.