V
vunet
Hello,
I want to create a useful function or sub whichever works great for
database connection to avoid typing same code all over. Earlier I was
using include file for opening and closing adoCon object and
connection. Now I really want to use a function to do it.
Can one recommend a good example?
I have this sample below which does not work for me because of the
mappath being wrong depending on what file under what directory calls
the file with this function:
Sub DB_CONN
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("./db/web.mdb") & ";"
End Sub
Sub DB_CONN_CLOSE
Set adoCon = nothing
End Sub
Thank you for any advice.
I want to create a useful function or sub whichever works great for
database connection to avoid typing same code all over. Earlier I was
using include file for opening and closing adoCon object and
connection. Now I really want to use a function to do it.
Can one recommend a good example?
I have this sample below which does not work for me because of the
mappath being wrong depending on what file under what directory calls
the file with this function:
Sub DB_CONN
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("./db/web.mdb") & ";"
End Sub
Sub DB_CONN_CLOSE
Set adoCon = nothing
End Sub
Thank you for any advice.