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
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