Results 1 to 15 of 15

Thread: Example of how to use RDO to open a connection to a database

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 1999
    Location
    Dulles, VA, U.S.A.
    Posts
    8

    Post

    I'm attempting to use RDO (Remote Data Object) 2.0 with VB6 to open a connection to a database (Informix in this case but it shouldn't matter). I can't seem to get it to work. Does anyone have a code sample that they would be willing to share showing me how to open a connection to a database.

  2. #2
    Addicted Member
    Join Date
    Oct 1999
    Posts
    232

    Post

    Try it:

    Code:
    Private Sub Sample()
    
    Dim rs As rdoResultset
    Dim cn As New rdoConnection
    Dim cl As rdoColumn
    Dim er As rdoError
    
    On Error GoTo EH
    
    With cn
        .Connect = "uid=;pwd=;server=SEQUEL;" _
        & "driver={SQL Server};database=pubs;" _
        & "DSN='';"
        .CursorDriver = rdUseNone
        .EstablishConnection rdDriverNoPrompt
        Set rs = cn.OpenResultset( _
          "select * from titles where Price < 50")
        For Each cl In rs.rdoColumns
            Debug.Print cl.OrdinalPosition,  _
             cl.Name, cl.Value
        Next
    End With
    Exit Sub
    
    EH:
        For Each er In rdoErrors
            Debug.Print er.Description
        Next er
        Resume Next
    
    End Sub
    ------------------
    smalig
    smalig@hotmail.com
    smalig.tripod.com

  3. #3
    Addicted Member
    Join Date
    Oct 1999
    Posts
    232

    Post

    And I have Oracle connection with RDO:

    Code:
    Sub LoginToDatabase()
    Dim Msg$
         On Error Resume Next
            With rdoCn
                .Connect = "DSN=oracle8;UID=guest;PWD=guest;"
                .LoginTimeout = 25
                .CursorDriver = rdUseOdbc
                .EstablishConnection rdDriverNoPrompt, False
            End With
        Exit Sub
    
    End Sub
    ------------------
    smalig
    smalig@hotmail.com
    smalig.tripod.com

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 1999
    Location
    Dulles, VA, U.S.A.
    Posts
    8

    Post

    Thanks smallig. I'm still getting an error (error 429 - Can't Create ActiveX Object). What version of VB are you using? I'm using the Professional Edition. I'm beginning to think that maybe I need the Enterprise edition.

    Any thoughts on that.

  5. #5
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    Post

    Just a thought...once I was using the dao object but I forgot to reference the object in project references. Same type of error...
    '''couldn't create object....
    Wayne

  6. #6

    Thread Starter
    New Member
    Join Date
    Oct 1999
    Location
    Dulles, VA, U.S.A.
    Posts
    8

    Post

    It's referenced. It points to msrdo20.dll. But thanks for the thoughts.

  7. #7
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308

    Post

    Don't know if it will help you:
    check http://support.microsoft.com/support.../Q177/3/94.ASP

    Good Luck
    Larisa

  8. #8
    Addicted Member
    Join Date
    Oct 1999
    Posts
    232

    Post

    Maybe you need go to 'Project'-'References' and select 'Microsoft Remote Data Object 2.0'?

    ------------------
    smalig
    smalig@hotmail.com
    smalig.tripod.com

  9. #9

    Thread Starter
    New Member
    Join Date
    Oct 1999
    Location
    Dulles, VA, U.S.A.
    Posts
    8

    Post

    Microsoft data object is selected. Still get the error.

  10. #10

    Thread Starter
    New Member
    Join Date
    Oct 1999
    Location
    Dulles, VA, U.S.A.
    Posts
    8

    Post

    Thanks for the input Larisa. I attempted to follow the procedure for the client side of that document and I can't. It says to select an option that I don't have when I execute the dcomcnfg.exe program.

  11. #11

    Thread Starter
    New Member
    Join Date
    Oct 1999
    Location
    Dulles, VA, U.S.A.
    Posts
    8

    Post

    What version of Visual Basic are you using Smalig? I'm using the Professional Edition. This code was originally written (and working) with Visual Basic 4.0 Enterprise Edition.

  12. #12
    Addicted Member
    Join Date
    Oct 1999
    Posts
    232

    Post

    I using VB6 now (3 years ago I started with VB3). Edition doesn't matter for this topic, I think. I have tested both my codes now, but they are working! I don't know your error - ask microsoft

    ------------------
    smalig
    smalig@hotmail.com
    smalig.tripod.com

  13. #13

    Thread Starter
    New Member
    Join Date
    Oct 1999
    Location
    Dulles, VA, U.S.A.
    Posts
    8

    Post

    I first posted a question about this error on 10/29 and got one response back then that said that RDO never worked in VB5 unless you had the Enterprise edition. I understand that you believe that it should work regardless of the edition (I think it should too). However, I have been staring at this problem for so long now that I am going nuts - I have looked all over the internet to see if Microsoft has any solution to the problem. I've tried everything that they suggested - nothing seems to work. I would be happy to ask Microsoft directly if I knew how. How does one ask them a question?

  14. #14
    Addicted Member
    Join Date
    Oct 1999
    Posts
    232

    Post

    I looked for edition problems but finding only about RDO activex features. I have Enterprise Edition, but it must work in Standard too. You can try EE if it's possible for you.

    Best regards.

    ------------------
    smalig
    smalig@hotmail.com
    smalig.tripod.com

  15. #15

    Thread Starter
    New Member
    Join Date
    Oct 1999
    Location
    Dulles, VA, U.S.A.
    Posts
    8

    Post

    Don't know if anybody cares but the problem seems to have been with VB 6 Professional edition. I finally found a Microsoft web site that spoke about my error (search on Q181852). It indicated that there was caused by mismatched .DLLs (between ODBC32.dll and msrdo20.dll). I tried 3 different ODBC32.dll files including one from the VB 6 install CD and they all had the same error. I found a copy of VB 6 on the Visual Studio CD and it worked fine with at least two of the ODBC versions (I never tried the third).

Posting Permissions

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



Click Here to Expand Forum to Full Width