Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

GetRows Method and "error '800a0c93' Operation is not allowed in this context."

Posted on 2003-11-26
7
Medium Priority
?
1,113 Views
Last Modified: 2007-12-19
Having a devil of a time figuring this one out, maybe because it's 3:30 in the a.m., but can anyone help me figure out why I get this error?

-------------------

ADODB.Recordset error '800a0c93'

Operation is not allowed in this context.

/ncc-lab/shooters/gallery.asp, line 162

-------------------

The line in question is:

-------------------
      aryCons=rsShooters.GetRows(PageSize, adBookmarkCurrent)
-------------------

Apparently, the reason it didn't error out on the earlier line similar to this one is that the IF statement is evaluating to false with my test data.

Full code snippet:

-------------------


Dim CurrentPage, I, aryPros, intProsPages, aryCons, intConsPages, intMaxPages
I = 5 ' the page size. Change to have more or less records per page displayed.
If IsEmpty(Request.QueryString("PageNumber")) Then
      CurrentPage=1
Else
      CurrentPage=CInt(Request.QueryString("PageNumber"))
End If

' filter the page for userProfessional state
rsShooters.Filter="userProfessional=" & true

if not rsShooters.EOF then
      ' set the page size for the rs, so that AbsolutePage knows
      ' what factor to go by and locate the current page.
      rsShooters.PageSize=I
      
      ' move the cursor to the first record of the page we want.
      rsShooters.AbsolutePage=CurrentPage
      
      ' if this didn't move the cursor off the end of the set
      ' get the data from the subset into an array
       aryPros=rsShooters.GetRows(PageSize, adBookmarkCurrent)
      
      ' before we get rid of this subset, count the pages and save it for later
      intProsPages=rsShooters.PageCount
      
      ' set the filter back to nothing
      rsShooters.Filter=adFilterNone


end if

' filter the set now for the amatures
rsShooters.Filter="userProfessional=" & false

if not rsShooters.EOF then
      ' set the page size again, for fun
      rsShooters.PageSize=I
      
      ' as before, move the cursor
      rsShooters.AbsolutePage=CurrentPage

      ' if this didn't move the cursor off the end of the set
      ' get the data from the subset into an array
      aryCons=rsShooters.GetRows(PageSize, adBookmarkCurrent)
      
      ' before we get rid of this subset, count the pages and save it for later
      intConsPages=rsShooters.PageCount
      
      ' set the filter back to nothing
      rsShooters.Filter=adFilterNone
end if

' compare the two numbers of pages and set intMaxPages to that value.
if intConsPages>intProsPages then
      intMaxPages=intConsPages
else
      intMaxPages=intProsPages
end if

----------------------


I know it's ugly, but can you spot where I go wrong?

0
Comment
Question by:kevinkcw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 3

Expert Comment

by:vijay7248
ID: 9823269
Hi,
May be this could solve ur prob..
Give
      rsShooters.Movefirst
after your  rsShooters.Getrows line

-Vijay
0
 
LVL 1

Author Comment

by:kevinkcw
ID: 9823327
Nope. I thought that too, at first. But I figured it out I think. Really was a 3 a.m. mistake. PageSize makes no sense in the context, PageSize is null, because it's not a variable. The variable I was using for PageSize is, actually, I. Plus, for whatever reason adBookmarkCurrent wasn't playing nice. Since I am working with the beginning of the subset anyway, this wasn't really necessary. But I'll give the points to whomever can tell me why adBookmarkCurrent was giving me an error (different one then is listed above.)
0
 
LVL 3

Expert Comment

by:vijay7248
ID: 9823395
Oh..I forgot to notice the Pagesize var..

adBookmarkCurrent or 0      - Points at the current record.
But in your case there is no current record at the beginning.
So try give rsShooters.Movefirst ......before the getrows

If still there is an error, replace adBookmarkCurrent with adBookmarkFirst or 1 , of course after giveing rsShooters.movefirst

adBookmarkFirst - points at the first record

Hope this helps..

-Vijay
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 21

Accepted Solution

by:
ap_sajith earned 375 total points
ID: 9823402
Have you included the adovbs.inc file?

If not you will have to use numeric constants instead...

BookmarkEnum Values

Constant                    Value           Description
adBookmarkCurrent     0                Starts at the current record
adBookmarkFirst          1                Starts at the first record
adBookmarkLast          2                Starts at the last record


For more info on recordset paging using getRows method, see http://www.devhome.org/asp/

Cheers!!
0
 
LVL 3

Expert Comment

by:vijay7248
ID: 9823496
I think the error might be what ap_sajith has pointed out..
Since removing adBookmarkCurrent has solved ur prob it means that you have not included adovbs.inc file..
Instead try using 0 as ap_sajith has pointed..
0
 
LVL 1

Author Comment

by:kevinkcw
ID: 9823652

I have the ADO enumerated constants with....

<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows 2000 Type Library" -->
<!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4" NAME="ADODB Type Library" -->


I will try using both the BookmarkEnum Values and moving the cursor to see if any of these answers work.

0
 
LVL 21

Expert Comment

by:ap_sajith
ID: 10243545
Hi,
Any Updates?. Do you need any further assistance with this?. Please close this question if no further assistance is needed.
If you need help closing this question, please refer to http://oldlook.experts-exchange.com/help/closing.jsp on how to close a question.

Cheers!!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question