473,581 Members | 3,213 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RecordSet.Move or RecordSet.Absol utePosition??

Hi,

I'm trying to use either one of these methods to position the cursor in a
specific position inside a recordset, but neither one seems to work.

For example, I have 10 records in my rsData recordset, and I issue this
command

rsData.Move 5, 1 'move to #5 from beginning

I then retrieve rsData("field_n ame"), expecting that it'd return field_name
of record #5, but it doesn't seem to work like that.

What am I missing? Is there a restriction on what type of cursor a recordset
must be opened in?

I'm using W2K/IIS5/ASP.

Thanks!

HH

Jul 19 '05 #1
8 15233
Hung Huynh wrote:
Hi,

I'm trying to use either one of these methods to position the cursor
in a specific position inside a recordset, but neither one seems to
work.

For example, I have 10 records in my rsData recordset, and I issue
this command

rsData.Move 5, 1 'move to #5 from beginning

I then retrieve rsData("field_n ame"), expecting that it'd return
field_name of record #5, but it doesn't seem to work like that.
What happens? Error message? Wrong record?
What record do you expect to get to when you move 5 records past the first
record (hint: 1 + 5 = 6)? I think you really want to use AbsolutePositio n
here.

What am I missing? Is there a restriction on what type of cursor a
recordset must be opened in?

Yes. In order to use the second argument, you must open a bookmarkable
cursor. Usually a static, keyset or dynamic cursor will work (forward only
will never work), but it can depend on the Provider you are using..One way
to make sure is to check the Supports method:
if rsData.Supports (adBookmark) then

You should be aware that the second argument in the Move method requires
ether a bookmark or a BookmarkEnum value. In your case, you are using "1",
which corresponds to vbBookmarkFirst , so you should get the desired result.
If you try using "2" you may be surprised at the result because "2"
corresponds to vbBookmarkLast.

HTH,
Bob Barrows
Jul 19 '05 #2
Just wanted to add: instead of scrolling through a cursor, you may wish to
consider using a GetRows array instead. It will perform much better, you
will be able to use the cheapest fastest cursor to populate it, and you will
be able to close your recordset and connection sooner, which is a good
thing.

Bob Barrows
Jul 19 '05 #3
> I'm trying to use either one of these methods to position the cursor in a
specific position inside a recordset, but neither one seems to work.


Why don't you get that record (or whatever subject you're using) via a WHERE
clause??? Why bother bringing back rows if you're not going to look at
them?
Jul 19 '05 #4
Thanks. I changed the CursorType and it works now.

HH

"Bob Barrows" <re******@NOyah oo.SPAMcom> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Just wanted to add: instead of scrolling through a cursor, you may wish to
consider using a GetRows array instead. It will perform much better, you
will be able to use the cheapest fastest cursor to populate it, and you will be able to close your recordset and connection sooner, which is a good
thing.

Bob Barrows

Jul 19 '05 #5
Well, I'm not just bringing back 1 record from query, so I can't just do a
WHERE condition.

My situation is this. I select 10 columns, with x number of rows and store
in recordset. I need to translate rs("title") to a different language, sort
by translated title, then display everything back (all 10 columns in the
order of sorted Title)

There's no way to pre-sort this translated Title from query by any means.
So, I do a regular query to retrieve all rows.

1. extract rs("title") from recordset to an array
2. translate rs("title") and sort the array, then move this into Dictionary
Object
3. now, the challenge is to display the recordset in the order of the sorted
dictionary. There's no way I can think of to match sorted dictionary with
the recordset, other than the Key index of the Dict. So, I loop through dict
and display like this:

For Each K in Dict
' K = 12, 4, 0, 2, 5....
rs.Move K, 1
'move to record K of RS recordset
'now I can call
RS("col1"), RS("col2")....D ict(F)....RS("c olx")
Next
This actuall does the trick. I just couldn't get RS.Move to work because I
had a wrong CursorType. Everything is working now. Thanks Bob for your
reply.

If you have other ways of accomplishing what I describe above, please
advice.

I also thought there should be a way to update RS.("title") =
Translated_Titl e, then I can call RS.Sort Title ...but I don't think I can
update the recordset in this manner.

HH
"Aaron Bertrand - MVP" <aa***@TRASHasp faq.com> wrote in message
news:OS******** ******@tk2msftn gp13.phx.gbl...
I'm trying to use either one of these methods to position the cursor in a specific position inside a recordset, but neither one seems to work.
Why don't you get that record (or whatever subject you're using) via a

WHERE clause??? Why bother bringing back rows if you're not going to look at
them?

Jul 19 '05 #6
> My situation is this. I select 10 columns, with x number of rows and store
in recordset. I need to translate rs("title") to a different language, sort by translated title, then display everything back (all 10 columns in the
order of sorted Title)

There's no way to pre-sort this translated Title from query by any means.


Why? You can't have computed columns in SQL Server, or a view, or even a
regular column that you update before you select (or on a periodic interval)
so that the foreign language title is also stored in the database? Then
your query could order by that column...
Jul 19 '05 #7
No, we don't store foreign Titles in table, only the English version is
stored. So, all translations have to be done after.

I tried to convince my boss that we should just translate and store foreign
titles once. But since the translation is fairly fast in real-time, he wants
the flexibility of changing an English titles anytime, then foreign Titles
will reflect right away.

HH

"Aaron Bertrand - MVP" <aa***@TRASHasp faq.com> wrote in message
news:u$******** ******@TK2MSFTN GP09.phx.gbl...
My situation is this. I select 10 columns, with x number of rows and store in recordset. I need to translate rs("title") to a different language, sort
by translated title, then display everything back (all 10 columns in the
order of sorted Title)

There's no way to pre-sort this translated Title from query by any

means.
Why? You can't have computed columns in SQL Server, or a view, or even a
regular column that you update before you select (or on a periodic interval) so that the foreign language title is also stored in the database? Then
your query could order by that column...

Jul 19 '05 #8
Hung Huynh wrote:
So, I loop through dict and display like this:

For Each K in Dict
' K = 12, 4, 0, 2, 5....
rs.Move K, 1
'move to record K of RS recordset
'now I can call
RS("col1"), RS("col2")....D ict(F)....RS("c olx")
Next
This actuall does the trick. I just couldn't get RS.Move to work
because I had a wrong CursorType. Everything is working now. Thanks
Bob for your reply.

If you have other ways of accomplishing what I describe above, please
advice.
I still think you could benefit from using a GetRows array, which will
perform better than a recordset.


I also thought there should be a way to update RS.("title") =
Translated_Titl e, then I can call RS.Sort Title ...but I don't think
I can update the recordset in this manner.

You can if you disconnect the recordset:
rs.open ...
set rs.activeconnec tion = nothing
'close your connection, it is no longer needed

Now you can update the recordset without affecting the data in your
database. You will then be able to use the recordset's Sort property,
allowing you to avoid the Dictionary object.

HTH,
Bob Barrows
Jul 19 '05 #9

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

Similar topics

0
1513
by: mad | last post by:
I am new here and don't know if someone has encountered and discussed this problem before. I appreciate any help to this problem. I am building a new Oracle database (8.1.7) and Win 2000/IIS 5 for development. After I moved ASP pages over from another server (also Oracle 8.1.7 and Win 2000/IIS 5), the error occurred when recordset's...
4
3158
by: Dalan | last post by:
I presume that using an open recordset method is the preferred method of accomplishing what I'm trying to do. Of course, if there are other options that would work, feel free to share them. I need to provide a means of scanning one field for all records and to trigger a message upon opening the form for alerting a user that maintenance...
3
5271
by: Kim Baker | last post by:
Problem creating a recordset object from another recordset object. 1. create first object. rstTemp with 10 fields - no problem 2. create second object rstTemp2 with one field - no problem 3. Attempt to create a third object with the following suedo code fails. SELECT rstTemp!fieldname1 FROM rstTemp WHERE rstTemp!fieldname2 =...
2
10570
by: salpay | last post by:
Hey kids. So I've got a non-updateable recordset in continuous forms, and each row has a button they can click to update the data in that row. So here's the trick I'm using: <do some updates of the row> iBookmark = Me.Recordset.AbsolutePosition - 1 Me.Requery
7
5271
by: JC | last post by:
Hey Folks, I am having a problem and I need some expert help. I am trying to populate a list box with a record set based off of a table field on the open procedure. I then want to have that list box adjust to what my user inputs into the box. Example... user enters last name and the list box scrolls through available values. Once...
1
4149
by: mark_aok | last post by:
Hi all, I have a form with a subform called "mySubForm" (the subform is always in datasheet view), and I have a button labeled "return item". When users click return item, it finds the record from the datasheet, and it modifies some fields. The problem is, I am randomly getting an error saying "no current record". When I check...
2
5501
by: wallconor | last post by:
Hi, I am having a problem using Dreamweaver CS3 standard recordset paging behavior. It doesn’t seem to work when I pass parameter values from a FORM on my search page, to the recordset on my results page. - Recordset Paging works if no parameters are used in the recordset sql code (ie. simple sql code): SELECT * FROM db_name WHERE...
3
6640
rsmccli
by: rsmccli | last post by:
Access 2002 Hi. I have a command button that will "approve" all records currently being looked at by an "approver". For some reason, even though there are multiple records that exist in the recordsetclone, EOF is returning true. I think this may have something to do with the sort order of the underlying query, but I'm not sure; at any rate, I...
1
2188
by: David Patz | last post by:
Hi, Im currently building a database for users to edit or manipulate train maintanence parts. For one of my forms - I display the inactive parts in stock. I've designed the form to have a datasheet view calling all inactive parts based on the type of part (Cylinder, Axle etc). All of this works however I am having difficulty selecting a...
0
7788
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...
0
8139
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. ...
0
8299
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5667
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...
0
3799
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3813
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2298
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
1
1398
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1127
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...

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.