Solved

RDO connect to server

Posted on 1998-11-10
3
652 Views
Last Modified: 2008-02-01
The following problem persists... since I'm rather new to ODBC and RDO, I hope you will be able to help me. I'm trying to connect to a db on a ODBC server. The following code will do so, if the db is on the development computer.

    Set cnDays = New rdoConnection
    With cnDays
    .Connect = "uid=;pwd=;dsn=sbqvtest;"
    .CursorDriver = rdUseOdbc
    .EstablishConnection rdDriverNoPrompt, True
    Do While .StillConnecting
        DoEvents
    Loop
    End With

So the DSN is defined on my computer (Scratchy). However, if I want to connect to a db on a different computer (i.e. Quimby), how do I do so. Trying the following always gives me a "DSN not found, etc" error

    Set cnDays = New rdoConnection
    With cnDays
    .Connect = "Server=quimby;uid=;pwd=;dsn=sbqv_test_2;"
    .CursorDriver = rdUseOdbc
    .EstablishConnection rdDriverNoPrompt, True
    Do While .StillConnecting
        DoEvents
    Loop
    End With

If I set the prompt variable to 0, it prompts me for a data source, but on MY computer, not on the specified server...
The DB is an access driver, specified as a system DSN. All computers are on the same network, but the goal is to access it over the Inet...
Thanks in advance
0
Comment
Question by:lbk
3 Comments
 

Expert Comment

by:umzilber
Comment Utility
ODBC already makes a connection to the server,  What you are trying to do defeats the purpose.

try to redo ODBC declaration in WINNT/WIN95 to point to the DB on Quimby and when you make a connection to RDO the location of the DB will be transparent and first version of the source will work just fine
0
 
LVL 1

Author Comment

by:lbk
Comment Utility
I'm not sure I'm following you. As I undetrstand now the problem with your solution is, that I don't want to use ODBC on the local machine. I want to run the control in IE on any random computer that has or doesn't have ODBC running. The control should then connect to quimby. The fact that it works with a local ODBC source is meaningless, other than for me to say that the code works on a local basis, but once the control is distributed, ODBC won't be available on the local machine
0
 
LVL 1

Accepted Solution

by:
mmahdi earned 100 total points
Comment Utility
Hi,

If you get a DSN not found error on another machine, means the DSN entry for that specific ODBC connection in the client machine is not present in which case you can register it at run-time using the following:

Put the following function in a module:

Private Sub RegisterDataSource()

Dim en As rdoEnvironment
Dim cnTest As rdoConnection
Dim strAttribs As String

' Build keywords string.
strAttribs = "Description=" & "DSN Test" & Chr$(13) & "OemToAnsi=No" & Chr$(13) & "SERVER=SERVERNAME" & Chr$(13) & "Network=(Default)" & Chr$(13) & "Database=DATABASENAME" & Chr$(13) & "Address=(Default)"  
' Create new registered DSN.
rdoEngine.rdoRegisterDataSource "DSN Test", "DSN Test", True, strAttribs

replace the variables SERVERNAME and DATABASENAME with your own values respectively.

When you load the form call the function RegisterDataSource to register the DSN. If the DSN is already registered nothing will happen.

I hope this will help.



Cheers
MMAHDI
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now