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

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 1759
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****************@TK2MSFTNGP12.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(position).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
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...
6
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...
9
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...
2
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
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...
6
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...
7
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...
4
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 =...
14
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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.