fnConnectToDatabase() fnConnectToDatabase(...) DESCRIPTION This function establishes an ADO connection to a database and provides error handling The function return an ADO connection SYNTAX set adoCon = fnConnectToDatabase([sDBname], [sServer], [sUserName], [sPassword], [sDriver]) EXAMPLE <%@ Language=VBScript %> <% Response.Buffer = true %> <% '-->-->-->-->-->-->-->-->--> dim adoCon set adoCon = fnConnectToDatabase("city_of_sydney", "203.62.157.199") Response.write(fnDataSELECT(adoCon, "tblPermProp")) set adoCon = nothing '--<--<--<--<--<--<--<--<--< %> RESULTS A connection is established or an error message is generated PARAMETERS [sDBname], {string} the database name [sServer], {string} the ip address of the server [sUserName], {string} a valid user name [sPassword], {string} a valid password for this user [sDriver]) {string} a driver type (e.g. sql server) STATUS working, tested 10% DEPENDENCIES fnErrorMessage (fnErrorMessage.asp) CREATED~ 12 April 2000 WORK HISTORY 7th Sept 2000 -- updated doc, started Java version PROGRAMMER Matthew Bishop LOCATION (At Isis: ntwsyd018) c:\librarycode\Javascript\aspFunctions\sourrceCode1\fnConnectToDatabase. asp DOCUMENTATION (At Isis: ntwsyd018) c:\librarycode\Javascript\AspFunctions\Documentation\fnConnectToDatabase .doc COMMENTS: a) small utility function b) The ActiveX Data Objects connection is passed back by the function, but is this a reference or a value??? ie does the original connection (internal to the fn) need to be closed??? c) This is untested for drivers other than sql server d) If you get the sServer parameter wrong, you're in big trouble. ADDITIONAL EXAMPLES a) (Modify the server ip address below) <%@ Language=VBScript %> <% Response.Buffer = true %> Testing the function fnConnectToDatabase <% '-->-->-->-->-->-->-->-->--> Dim adoConnection adoConnection = fnConnectToDatabase( _ "city_of_sydney", _ "203.62.157.199", _ "sa", "max", "sql server") '--<--<--<--<--<--<--<--<--< %> RESULTS as above SEE ALSO fnShowRecord(), fnDisplayRecordset(),