Evening ( morning. ahh shucks... Hi.
Learning ASP but been VB
programmer and I think some habits die hard...
can someone please explain the error of my ways..
I want to have a connection opened in a function or subroutine as follows
it's in a seperate include file and yes included....
Set Conn = Server.CreateObject("ADODB.Connection")
MdbFilePath = "D:\Inetpub\wwwroot\Database\" & DB & ".mdb"
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & MdbFilePath & ";User Id=admin;Password="
SetConn = Conn
db is passed to it by calling it such as
Set MyConn = SetConn("Helpdesk")
after 'set'ing the RS and msql for the sql statement
RS.Open msql, MyConn works fine......
however, you can't use MyConn.Close as the object doesn't exist...
I have tried elsewhere and suggestion was put it in a sub in an inc file ( which the function already is )
The reason for having as a function is so I have one point of code to change, and it's used frequently in the code.
Does anyone have experience with this or any suggestions.....
I just want to be able to close MyConn.