?
Solved

RDO connect to server

Posted on 1998-11-10
3
Medium Priority
?
687 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 200 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month13 days, 14 hours left to enroll

800 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