Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 25th, 2004, 08:52 AM
Registered User
 
Join Date: Jun 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Invalid bookmark in an unbound grid with Oracle 9i

Hi, we have an application that worked on Oracle 8i with oo4o and oraoldb.

We use a Sheridan grid in unbound mode with the following code in the unboundReadData event where RecGlobal is an OraDynaset:

Public Sub UnboundReadData(RowBuf As SSDataWidgets_B.ssRowBuffer, StartLocation As Variant, ReadPriorRows As Boolean)
On Error GoTo ErrorGridStreetSectorUnboundReadData:

    Dim Rcnt, Rcount, Rcounter As Integer

    If Grid.Redraw = False Then Exit Sub
    If recGlobal Is Nothing Then Exit Sub
    If IsNull(StartLocation) Then
        If ReadPriorRows Then
            recGlobal.MoveLast
        Else
            recGlobal.MoveFirst
        End If
    Else
        'Conversion from HEX string to Binary string
        recGlobal.Bookmark = objMain.HexToBookmark(StartLocation)
        If ReadPriorRows Then
            recGlobal.MovePrevious
        Else
            recGlobal.MoveNext
        End If
    End If
    For Rcount = 0 To RowBuf.RowCount - 1
        If recGlobal.BOF Or recGlobal.EOF Then Exit For
        Select Case (RowBuf.ReadType)
            Case 0
                For Rcounter = 0 To RowBuf.ColumnCount - 1
                    RowBuf.Value(Rcount, Rcounter) = recGlobal(Grid.Columns(Rcounter).Name).Value
                Next Rcounter
                RowBuf.Bookmark(Rcount) = objMain.BookmarkToHex(recGlobal.Bookmark)
            Case 1
                RowBuf.Bookmark(Rcount) = objMain.BookmarkToHex(recGlobal.Bookmark)
            Case 2
                RowBuf.Value(Rcount, Rcounter) = recGlobal(Grid.Columns(Rcounter).Name).Value 'recGlobal(Rcounter).Value
                RowBuf.Bookmark(Rcount) = objMain.BookmarkToHex(recGlobal.Bookmark)
            Case 3
        End Select

        If ReadPriorRows Then
            recGlobal.MovePrevious
        Else
            recGlobal.MoveNext
        End If
        Rcnt = Rcnt + 1
    Next Rcount
    RowBuf.RowCount = Rcnt

ExitGridStreetSectorUnboundReadData:
    Exit Sub
ErrorGridStreetSectorUnboundReadData:
    Dim ErrNum As Long, ErrDesc As String
    ErrNum = objMain.GetLastError(Err.Number)
    Select Case ErrNum
        Case 3021
        Case 40088: Grid.ReBind 'No open cursor
        Case 40022 'Resultset is empty
        Case Else
            ErrDesc = objMain.GetLastErrorDesc(Err.Description)
            MsgBox ErrNum & " : " & ErrDesc, CriticalFlag, Msg(1)
    End Select
    Resume ExitGridStreetSectorUnboundReadData:
End Sub

Here is the code for the HexToBookmark and BookmarkToHex functions we use:

Private Function Mainfunctions_HexToBookmark(ByVal S As Variant) As Variant
    Dim I As Integer, STmp As Variant
    If IsNull(S) Then Exit Function
    For I = 1 To Len(S) Step 2
        STmp = STmp & Chr(Val("&h" & Mid(S, I, 2)))
    Next
    Mainfunctions_HexToBookmark = STmp
End Function

Private Function Mainfunctions_BookmarkToHex(ByVal S As Variant) As Variant
    Dim I As Integer, H As String, STmp As Variant
    For I = 1 To Len(S)
        H = Hex(Asc(Mid(S, I, 1)))
        If Len(H) = 1 Then H = "0" & H
        STmp = STmp & H
    Next
    Mainfunctions_BookmarkToHex = STmp
End Function


Now we need to make our application run on Oracle 9i (patchset 9204) (with oraoledb 9.2.0.4.0 and oo4o 9.2.0.4.8) and our Sheridan Grid in unbound mode seems to work fine, except that after some time I reexecute the query to refresh the grid I get an invalid bookmark error message (OIP.4121) and only 10 records from the recordset are displayed even if the recordcount is greater.

Anything that can help solve this somehow weird problem is welcome.
Thanks






Similar Threads
Thread Thread Starter Forum Replies Last Post
IMMEDIATE (Oracle 9i Developer Book) hellofnk Oracle 0 March 24th, 2006 05:44 AM
Installation of Oracle 9i sreechand_b Oracle 4 September 13th, 2005 08:10 AM
Tomcat 5.0.28 and Oracle 9i etpoole Apache Tomcat 0 June 17th, 2005 04:18 PM
Help -- About Oracle 9I and Tuxedo Performance jamestong Oracle 0 May 19th, 2005 03:11 AM
Oracle 9i OCI knguyen Oracle 0 August 12th, 2003 07:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.