473,808 Members | 2,860 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Record Position

Hi to all,

I want to know if there is a way of getting the position of the
particular record in the dataset aside from CurrencyManger. position
let say for example we have a record..

cntID Name
1 Richard
2 Lucas
3 Jesus
I want to know the position of Jesus in the Record number 3 in the
dataset, if there is any please share it to me...
Thanks
Mark
Nov 20 '05 #1
3 1779
you could loop thrue all the records to check if its the one you need
for doing w you want i would suggest using a dataview instaid of a dataset,
just create a new view w the table of the dataset and use the find function.

eric

"Mark Vergara" <ma************ @hotmail.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hi to all,

I want to know if there is a way of getting the position of the
particular record in the dataset aside from CurrencyManger. position
let say for example we have a record..

cntID Name
1 Richard
2 Lucas
3 Jesus
I want to know the position of Jesus in the Record number 3 in the
dataset, if there is any please share it to me...
Thanks
Mark

Nov 20 '05 #2
BB
Mark,

I've been trying to figure out the same thing, and have
posted here before, but have not come up with a good
answer yet, other than looping through all the rows to
find a match.

I've played with hooking the ListChanged event on the
dataview, which returns the old and the new index of a
changed/added item in the list, but haven't found any
consistency in the results. Because the index of any/all
rows changes when you do an insert, you can get a lot of
events raised when you do a single insert. For example,
when you add an item to an unsorted list, you get a
single event with event-type "add" and the index where
you'd expect it (at the end). But, if you add to a
sorted list, in the cases I tried it added my new record
at the beginning (index 0), and then fired off more
events as it "moved" it into the right sorted position in
the list. As this move was happening, I'm not sure why I
didn't get even more events, as the indices of the other
items in the list had to have been changing around as
well. Finally, if the change you make to the list
entails wholesale changes to the indices in the list,
you'll get a single event type ("reset", I think) that
basically says the changes were so drastic that you
shouldn't bother looking at each event.

You'd think there'd be something like a "record id" which
doesn't change as you move things around, but I haven't
found it yet.

Also, if you don't mind sorting the dataview, you can use
myDataview.Find to find the index of your key. That's
probably more efficient than looping through the
collection of rows yourself, but I don't know. I'd sure
think there's a raw iteration of an unordered list
somewhere, rather than doing your own foreach, but I
haven't found it.

HTH,

Bill Borg
-----Original Message-----
Hi to all,

I want to know if there is a way of getting the position of theparticular record in the dataset aside from CurrencyManger. positionlet say for example we have a record..

cntID Name
1 Richard
2 Lucas
3 Jesus
I want to know the position of Jesus in the Record number 3 in thedataset, if there is any please share it to me...
Thanks
Mark
.

Nov 20 '05 #3
Cor
Hi Mark,

Reading the answer, I don't believe that you can find with a dataview, a
seek, a sort, a select a position of a datarow in a dataset. You can find a
datarow or an array of datarows with that.

I give you an example roughly written here.
\\\
dim position as integer
for position = 0 to dataset.tables( 0).rows.count-1
if dataset.tables( 0).rows(positio n).item("name") = "Jezus"
'you have you position, if it is the first it is very fast
exit for
end if
next
///
I think that all other methods (if they could work) will cost more time
because the need internaly to do something the same especially a sort from a
big dataset.

I hope this helps a bit?

Cor

I want to know if there is a way of getting the position of the
particular record in the dataset aside from CurrencyManger. position
let say for example we have a record..

cntID Name
1 Richard
2 Lucas
3 Jesus

Nov 20 '05 #4

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

Similar topics

1
4330
by: Rowan | last post by:
Hi there, it has been a while since i have posted. I am in a situation where I am stumped. I am learning to build a dts package where I am connecting to a table in an AS400. This database is being maintained by an outsourced company and therefore I can't change the table structure or even ask them to. Anyway, this table currently has about 104,000 records. I am building a package to check it and pull out the most recent records and...
6
15819
by: Prakash | last post by:
Hi !! In a Continuous Form with say 10 records, I'd like to have 1 button with an "UP" Arrow & another button with a "DOWN" arrow. By pressing either the Up or the Down Arrow, I'd like the user to be able to MOVE the records up or down the order. Something like in a WinAmp or MusicMatch Playlist. A little sample code would be much appreciated.
9
424
by: Greg | last post by:
Binding Manager & dataset - won't add record I've got an untyped dataset with controls bound through code. The user can select a question number from a bound combobox, and the question number and question text are displayed in bound textboxes. This part works fine. When I go to add a new record, the textboxes clear as they should. I enter a new question number and tab to the textbox for the question text. At this point, the text for the...
2
1216
by: Mark Vergara | last post by:
Hi! Is there any way of finding of what position in a particular record ? For example I have 3 records 1 Record 1.. 2 Record 2.. 3 Record 3..
3
6460
by: zhouzhendong | last post by:
I have a form that shows a table in single form format. how can I know the position of the record the form is current showing so that I can enable or disable some buttons according to the position information. For example if the form is showing the first record I need to disable the Previous button, and for the last record I need to disable the Next button, etc. Thanks
6
3862
by: polocar | last post by:
Hi, I'm writing a program in Visual C# 2005 Professional Edition. This program connects to a SQL Server 2005 database called "Generations" (in which there is only one table, called "Generations"), and it allows the user to add, edit and delete the various records of the table. "Generations" table has the following fields: "IDPerson", NamePerson", "AgePerson" and "IDParent". A record contains the information about a person (his name, his...
7
27843
by: Dale Sampson | last post by:
As you can tell, I am new to VS.net. I have a VB project with a defined data source pointing to a table in a ..mdb file.-- The associated fields are displayed in textboxes using the tableBindingSource. There is also an associated BindingNavigator. The table's primary key is a field called 'who'. I have a valid value for 'who' and want to set the Navigator to the record that contains this value so the fields are displayed in the associated...
4
2231
by: Bakarre | last post by:
I have problem in retrieving record from mysql using php form, I was able to retrieve the record, if I edit, the changes is not updated in mysql. find below my code <html> <body> <?php $db = mysql_connect("localhost", "root"); mysql_select_db("k1",$db); $id = $_POST; echo $id;
14
1875
by: Arli | last post by:
I am using Access 2003. I have a form that has text boxes labeled Position 1 T1, Position 1 T2, Position 2 T1, and Position 2 T2. When I create a new record, I want the same values to save into the new record unless a yes/no check box is selected on the new record (I also would like to gray out the entry altogether for update unless the check box is selected-that I found). I have looked all through the properties and can find no way to do...
0
9721
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
9600
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
10631
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
10374
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
10114
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
9196
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...
1
7651
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
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3011
bsmnconsultancy
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...

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.