Solved

RDO connect to server

Posted on 1998-11-10
3
677 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Expert Comment

by:umzilber
ID: 1444142
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
ID: 1444143
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
ID: 1444144
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

739 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