11-23-2007, 05:50 AM
|
#3 (permalink)
|
| Junior Member Join Date: Nov 2007 Location: London
Posts: 1
Rep Power: 0  | Have a look at SessionContext.RegRoot, this gives the root location in the HKLM branch of the registry, and under the General key is the DSN that the current connection is using. I use an api function to get the string (I'm using VB6 for this)
sDSN=GetRegistryValue(HKLM, oSessionContext.RegRoot & "\General", "DSN")
which returns the DSN, that I then use to construct the ADODB connection string (using ODBC)
adDB.Connection = "ODBC;DSN=" & sDSN & ";UID=<custom db user>;PWD=******"
This still requires that you are able to create a user on the SQL server with (ideally) read-only permissions on the RE database.
Hope that helps
Wayne Tarr
London, UK |