Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

avoiding DSN-Less Connection prompt

Status
Not open for further replies.

AT76

Technical User
Apr 14, 2005
460
US
Hi all,

I'm connecting to an Oracle database thru code via DSN. Here's what I have:
Code:
    Dim nRet As Long
    Dim sDriver As String
    Dim sAttributes As String

    sDriver = "Oracle73 Ver 2.5"
    sAttributes = "Server=PRA1" & Chr$(0)
    sAttributes = sAttributes & "DESCRIPTION=" & sDSN & Chr$(0)
    sAttributes = sAttributes & "DSN=DSNNAME" & Chr$(0)
    sAttributes = sAttributes & "DATABASE=DB" & Chr$(0)
    sAttributes = sAttributes & "UID=userid" & Chr$(0)
    sAttributes = sAttributes & "PWD=password" & Chr$(0)

DBEngine.RegisterDatabase "currentRegistrations", "Oracle73 Ver 2.5", True, sAttributes

I'm harcoding the userid and password in the above code but when my app tries to connect to an Oracle table I still get a propmt for the user to input the userid and password. Is there a way to avoid this?

Thanks!
 
What happen if you replace all your Chr$(0) with vbCr ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I tried it but I still get the same thing PHV.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top