I am currently using the following (which works), but is there a 'better' way to do this?
(I don't like hardcoding the connection string with username and password.)
'-----------------------------------------------------------------------------------------------------------------------------------------------------------------
'Thomas Graff, Eastern Technologies, Inc. 2/6/2018
'This script is designed to look up the state and city from information in the Zip Code maintenance table
' and then populate the City and State fields.
'Init VARs
EPAZIP = ""
retVal = oBusObj.GetValue("UDF_EPA_ZIPCODE$", EPAZIP)
Set SQLDB = CreateObject("ADODB.Connection")
SQLDB.OPEN("Provider=SQLNCLI11;User ID=<id>;PWD=<pw>;Initial Catalog=MAS_SYSTEM; Data Source=<server>;")
Set rs = CreateObject("ADODB.Recordset")
rs.open "SELECT City, StateCode, CountryCode from SY_ZipCode where ZipCode like '"+EPAZIP+"'",sqldb,1,1
if rs.eof = false then
retVal = oBusObj.setValue("UDF_EPA_City$", rs("City").value)
retVal = oBusObj.setValue("UDF_EPA_State$", rs("StateCode").value)
end if
rs.close
'-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks,
-Tom