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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL DSN connection and passwords

Status
Not open for further replies.

Ragol1

Programmer
Oct 25, 2001
315
US
Hello,

I have a DSN connection to SQL that works great and I have some code that connects to it but in order for it to work I MUST add the userID and password to the code. Is there a way to not add the USERID and Password to the code and have the DSN connection deal with it. I can get it to work with Access but with SQL it says it’s not associated with a trusted connection.


any Ideas


MyDSN = "DSN=test"
sql="select * from domains where domain='test.com'"
Set Conn=CreateObject("ADODB.Connection")
Conn.Open MyDSN
set rs=CreateObject("ADODB.recordset")
rs.Open sql, Conn

if not rs.eof then

msgbox rs("domain")

else
msgbox "not found"
end if

rs.Close
Conn.Close
set rs=nothing
set Conn=nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top