Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2003-11-26
7
Medium Priority
?
1,118 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
  • 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 Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

926 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