Below I made two functions (VBScript) to open and close a database connection. Problem, I get a syntax error using these functions... I am trying to use the functions in an include file since it is used in multiple scripts...
When I am calling it, I am just using the function name
DBOpen... this gives me a syntax error pointing to Function.
when I actually place it in my code, I get the following error.
Microsoft VBScript runtime error '800a01a8'
Object required: ''
First time I ever tried using functions to open and shut a db.
Function DBOpen()
Set Conn = Server.CreateObject("ADODB.Connection"
Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
Conn.ConnectionString = "Data Source=d:\home\pathtodb\mydb.mdb"
Conn.Open
Set Rs = Server.CreateObject("ADODB.Recordset"
End Function
Function DBClose()
Rs.Close
Set Rs = Nothing
Conn.Close
Set Conn = Nothing
End Function
When I am calling it, I am just using the function name
DBOpen... this gives me a syntax error pointing to Function.
when I actually place it in my code, I get the following error.
Microsoft VBScript runtime error '800a01a8'
Object required: ''
First time I ever tried using functions to open and shut a db.
Function DBOpen()
Set Conn = Server.CreateObject("ADODB.Connection"
Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
Conn.ConnectionString = "Data Source=d:\home\pathtodb\mydb.mdb"
Conn.Open
Set Rs = Server.CreateObject("ADODB.Recordset"
End Function
Function DBClose()
Rs.Close
Set Rs = Nothing
Conn.Close
Set Conn = Nothing
End Function