Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2003
    Posts
    2

    Unanswered: 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"

  2. #2
    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

  3. #3
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •