I am currently experiencing problems with trying to use a subroutine to create a generic database connection that i can call each time I require it.
My code is as follows:
dbConnString = "Provider=SQLOLEDB;server=SERVER_ADDRESS;database=DATABASE;uid=USERID;password=PASSWORD;"
set objConn = Server.CreateObject("ADODB.Connection")
objConn.CommandTimeOut = 100
if blnRecordset then
set objRs = server.CreateObject("ADODB.Recordset")
set objCmd = Server.CreateObject("ADODB.Command")
objCmd.CommandTimeOut = 100
objCmd.ActiveConnection = objConn
response.write isobject(objCmd) & "<br>"
As shown by the output, the Command object is created in the sub but not available immediately after on the page itself. The code works flawlessly without the use of a sub - it is only when enclosed within the subroutine I am experiencing this problem.
If anyone has an idea why this is happening, I'd be very grateful for a response.
Many thanks for your time