Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Bookmark is invalid

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-13-03, 15:55
FBMange FBMange is offline
Registered User
 
Join Date: Apr 2003
Posts: 2
Bookmark is invalid

Hello everyone!

I am using ASP to access items in Exchange 2000's Web Storage System. I'm getting a recordset and I can display the first record, but when I try and rsADO.MoveNext it fails, giving a "Bookmark is invalid" error.

Strange thing is MoveLast and MoveFirst work, but MoveNext doesn't. I considered it could be the cursor, but if it supports MoveFirst and Last surely MoveNext should work?

Wonder if anyone has any ideas.

Here's my code,

<%
Dim sURL
sURL = "http://bernice.bernard.com/exchange/administrator"

'Connect to Exchange
Dim connADO
Set connADO = Server.CreateObject("ADODB.Connection")
connADO.Provider = "ExOLEDB.DataSource"
connADO.ConnectionString = sURL
connADO.Open

'Create Recordset object
Dim rsADO
Set rsADO = Server.CreateObject("ADODB.Recordset")

'Build query
Dim sSQL
sSQL = "select "
sSQL = sSQL & chr(34) & "urn:schemas:mailheader:content-class" & chr(34) & " "
sSQL = sSQL & "," & chr(34) & "DAV:href" & chr(34) & " "
sSQL = sSQL & ", " & chr(34) & "DAV:displayname" & chr(34) & " "
sSQL = sSQL & "from scope ('shallow traversal of "
sSQL = sSQL & Chr(34) & sURL & Chr(34) & "') "
sSQL = sSQL & "ORDER BY " & chr(34) & "DAV:displayname" & chr(34)

'Run query
rsADO.Open sSQL, connADO

'Display items
Response.Write("RecordCount:" & rsADO.RecordCount)
rsADO.MoveLast
rsADO.MoveFirst

Do While Not rsADO.BOF or rsADO.EOF
Response.Write("<BR>" & rsADO("DAV:href"))
rsADO.MoveNext
Loop

rsADO.Close
%>



And this is what I get when I run it...

"RecordCount:9
http://bernice.bernard.com/exchange/...rator/Calendar
Provider error '80040e0e'

Bookmark is invalid.

/index.asp, line 38"
Reply With Quote
  #2 (permalink)  
Old 05-05-03, 09:29
ZuperGirl ZuperGirl is offline
Registered User
 
Join Date: May 2003
Posts: 1
The error is right here:

Do While Not rsADO.BOF or rsADO.EOF

You do the loop when cursor not before the first record OR when the cursor is after the last record. So, you get an error at the end of the recordset....

Change to:

Do While Not rsADO.EOF
Reply With Quote
  #3 (permalink)  
Old 05-05-03, 09:38
FBMange FBMange is offline
Registered User
 
Join Date: Apr 2003
Posts: 2
Hi ZuperGirl, thanks for you suggestion.

I know I shouldn't have BOF or EOF but that wasn't the problem. If I do this...

'Display items
Response.Write("RecordCount:" & rsADO.RecordCount)

rsADO.MoveFirst
Response.Write("<BR>" & rsADO.bookmark)
Response.Write("<BR>" & rsADO("DAV:href"))

rsADO.MoveLast
Response.Write("<BR>" & rsADO.bookmark)
Response.Write("<BR>" & rsADO("DAV:href"))

Response.Write("<BR>" & rsADO.cursortype)
Response.Write("<BR>" & rsADO.cursorlocation)
Response.Write("<BR>" &
rsADO.supports(adMovePrevious))

rsADO.MovePrevious

rsADO.Close





I still get the error... the code above returns

RecordCount:9
4.91004949374068E+18
http://bernice.bernard.com/exchange/...rator/Calendar
5.27033746393032E+18
http://bernice.bernard.com/exchange/administrator/Tasks
2
2
True
Provider error '80040e0e'
Bookmark is invalid.

/index.asp, line 59
(where line 59 is the MovePrevious)


I got to the bottom of the issue in the end... it's a bug with ADO 2.6 and not my code at all!

I was runnning MDAC 2.6 RTM, installing MDAC 2.7 has
sorted it out.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On